Using c-treeSQL for Condition EvaluationA c-treeSQL SELECT statement can be used for condition evaluation in an ESQL program. The condition evaluation is done using the SYSCALCTABLE. The following example shows the usage of the SELECT statement to check whether the ship_date is valid: Example Using c-treeSQL for Condition Evaluation
SELECT 1 INTO :result FROM admin.syscalctable WHERE :ship_date > SYSDATE AND :ship_date < ADD_MONTHS (:order_date, 1) ;
printf ("ship_date valid ") ;
else if (sqlca.sqlcode == SQL_NOT_FOUND) printf ("ship_date invalid ") ;
else printf ("Error ") ;
The previous example returns the value 1 if the validation is successful. If not, the validation is unsuccessful. |
|||