Progress
Embedded SQL-92
Guide and Reference


Using Indicator Variables for Error Handling

You can use indicator variables in an ESQL application program to detect whether the retrieved value is NULL or has been truncated. The value is truncated when the length of the returned value is greater than the length of the target host variable.

See "Handling NULL Values in ESQL-92," for more information on evaluating indicator variables.

These are the values for indicator variables and their meanings:

EXAMPLE

The following code fragment shows how to evaluate indicator variables to detect null:

EXEC SQL 
     SELECT ename, deptno, commission 
     INTO :ename_v, :deptno_v, :commission_v:commission_i 
     FROM employee 
     WHERE empno = 2002 ; 
if (commission_i == -1) 
     printf ("No commission recorded for employee %s ", ename_v) ; 

This example evaluates the indicator variable commission_i to determine if the retrieved value for the commission column is NULL.


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