Previous Topic

Next Topic

Using Indicator Variables

Programs can use indicator variables along with input and output host variables. With input host variables, programs can insert a NULL value by setting the indicator variable is set to -1. With output variables, programs check indicator variables for NULL values and other error conditions.

The value of an indicator variable is interpreted as given below:

0

The value has been placed in the host variable and is not NULL and has not been truncated.

-1

The returned value is NULL and the value of the host variable is not defined.

>0

The returned value was truncated since the host variable size was too small. The indicator value is the actual value length before truncation.

When a query is made, it is suggested that an indicator variable be used to check for NULL values, on columns that can contain NULL values.