Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 (Français) » SQL Anywhere Server - Programming » Embedded SQL » Using host variables

 

Indicator variables

Indicator variables are C variables that hold supplementary information when you are fetching or putting data. There are several distinct uses for indicator variables:

  • NULL values   To enable applications to handle NULL values.

  • String truncation   To enable applications to handle cases when fetched values must be truncated to fit into host variables.

  • Conversion errors   To hold error information.

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. For example, in the following INSERT statement, :ind_phone is an indicator variable:

EXEC SQL INSERT INTO Employees
 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.

Note

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.


Using indicator variables to handle NULL
Using indicator variables for truncated values
Using indicator values for conversion errors
Summary of indicator variable values