Progress
Embedded SQL-92
Guide and Reference


Using SQL for Condition Evaluation

You can use an SQL SELECT statement for condition evaluation in an ESQL program. The condition evaluation is performed using the syscalctable system table.

EXAMPLE

The following example shows how to use the SELECT statement to check whether the value in the ship_date column is valid:

EXEC SQL
     SELECT 1
     INTO :result
     FROM sysprogress.syscalctable
     WHERE :ship_date > SYSDATE
     AND :ship_date < ADD_MONTHS (:order_date, 1) ;
 
if (sqlca.sqlcode == 0)
     printf ("ship_date valid \n") ;
else
if (sqlca.sqlcode == SQL_NOT_FOUND)
     printf ("ship_date invalid \n") ;
else
     printf ("Error \n") ; 

The above example returns zero ( 0 ) in SQLCA.SQLCODE if the validation is successful. If the validation is unsuccessful SQLCODE is not set to zero.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095