5. Embedded SQL for Ada : Ada Variables and Data Types : Embedded SQL/Ada Declarations : Indicator Variables
 
Share this page                  
Indicator Variables
An indicator variable is a 2-byte integer variable. You can use an indicator variable in three possible ways in an application:
In a statement that retrieves data from Ingres. You can use an indicator variable to determine if its associated host indicator variable was assigned a null.
In a statement that sets data to Ingres. You can use an indicator variable to assign a null to the database column, form field, or table field column.
In a statement that retrieves character data from Ingres, you can use the indicator variable as a check that the associated host variable was large enough to hold the full length of the returned character string. However, the preferred method is to use SQLSTATE.
In order to declare an indicator variable, you should use the short_integer data type. The following example declares two indicator variables:
ind:     Short_Integer; -- Indicator variable
ind_arr: array(1..10) of Short_Integer; --Indicator array
When using an indicator variable with an Ada record, you must declare the indicator variable as an array of 2-byte integers. In the above example, you can use the variable "ind_arr" as an indicator array with a record assignment. Note that a variable declared with any derivative of the short_integer data type will be accepted as an indicator variable