Checking Indicator Variables to Test for Returned Null ValuesIndicator variables can also be used to test whether a returned value is a null value. This is done by using the indicator variables along with host variables used for output. The following example shows how to use indicator variables in the INTO clause of a SELECT statement to check for null values. Example Using Indicator Variables to Check for Returned Null Values
long cust_no ; char phone [13] ; short i_phone ; EXEC SQL END DECLARE SECTION ;
EXEC SQL SELECT c_phone INTO :phone:i_phone FROM customer WHERE cust_no = :cust_no ;
printf ("No Phone Number\\n") ;
else printf ("Phone Number is %s\\n", phone) ;
For more information on indicator variables, see "NULL Value Handling in ESQL" and "Error Handling in ESQL". |
|||