Referring to Indicator Variables
The general format for referring to indicator variables in an ESQL program is shown below:
:host_variable_name [ INDICATOR ] :indicator_variable_name
Always use a host variable name when you use an indicator variable reference, and always precede both references with a colon. The optional keyword INDICATOR clarifies the presence and purpose of the indicator variable.
Valid values for an indicator variable and their meaning is as follows:
0
|
The associated host variable contains a non-null value. If set by c-treeSQL, a value of 0 also indicates the value in the host variable has not been truncated.
|
-1
|
The value of the associated host variable is null.
|
>0
|
The value in the associated host variable was truncated because the variable was too small. The value in the indicator variable is the actual length of the value before truncation.
|
Keep in mind the following points about indicator variables. Indicator variables must:
- Be explicitly declared in the ESQL declare section.
- Be declared as short or SMALLINT type.
- Be preceded by a colon (:) when used in an ESQL statement.
- Not be preceded by a colon when used in a C statement.
- Not be named an c-treeSQL reserved word.
- Must be preceded by its associated input host variable when used in an ESQL statement.
|