Indicator variables are C variables that hold supplementary information about a particular host variable. You can use a host variable when fetching or putting data. Use indicator variables to handle NULL values.
An indicator variable is a host variable of type a_sql_len that is placed immediately following a regular host variable in a SQL statement. To detect or specify a NULL value, place the indicator variable immediately following a regular host variable in a SQL statement.
For example, in the following INSERT statement, :ind_phone is an indicator variable.
EXEC SQL INSERT INTO Employee VALUES (:employee_number, :employee_name, :employee_initials, :employee_phone:ind_phone ); |
On a fetch or execute where no rows are received from the database server (such as when an error or end of result set occurs), then indicator values are unchanged.
To allow for the future use of 32 and 64-bit lengths and indicators, the use of short int for embedded SQL indicator variables is deprecated. Use a_sql_len instead.
The following table provides a summary of indicator variable usage:
Indicator value | Supplying value to database | Receiving value from database |
---|---|---|
0 | Host variable value | Fetched a non-NULL value. |
-1 | NULL value | Fetched a NULL value |
Indicator variables to handle NULL
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |