Using Indicator Variables to Retrieve NULL Values

This code fragment retrieves output to the host language variable :lowmark and the corresponding indicator variable mc.

EXEC SQL SELECT credit\-limit INTO :lowmark INDICATOR :mc
           FROM customer
          WHERE cust\-num = :lowcustnum; 

If the selected credit-limit contains a NULL value, mc is set to -1.

Similarly, cn is set to -1 in the following code fragment for each instance of the cust-num column that contains a NULL value:

EXEC SQL DECLARE x CURSOR FOR SELECT cust\-num, name, city, state
                              FROM customer;
EXEC SQL OPEN X;
EXEC SQL FETCH x INTO :custnum INDICATOR :cn, :nam, :city, :state; 


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