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
- 0
The returned value is NOT NULL and has not been truncated. The corresponding host variable contains the retrieved value.
- -1
The returned value IS NULL and the value of the corresponding host variable is not defined.
- > 0
The returned value was truncated because the length of the host variable was too small. The > 0 value in the indicator variable is the actual length of the returned value before it was truncated.
The following code fragment shows how to evaluate indicator variables to detect null:
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 |