Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Using indicator variables

A host variable can only be combined with an indicator variable for the purpose of querying data in the database, inserting values in the database, updating values in the database or for use in calculations (functions, expressions, predicates, search conditions).

You specify an indicator variable after the host variable. They may be separated by the keyword INDICATOR, although this is not necessary:
:host-variable [INDICATOR] :indicator-variable

If the host variable is a vector, the associated indicator variable must also be a vector with the same number of elements. Each element in the host variable is assigned the corresponding element in the indicator variable. The syntax for vectors is language-specific and is described in thel “ ESQL-COBOL for SESAM/SQL-Server” manual.

Querying values

SESAM/SQL assigns one of the following values to the indicator variable when you query a value in the database and subsequently assign it to a host variable:


0

The host variable contains the value read.
The assignment was error free.

-1

> 0

The value to be assigned is the NULL value.

For alphanumeric or national values:
The host variable was assigned a truncated string.
The value of the indicator variable indicates the original length in code units.

Inserting or updating values

If you specify values in SQL statements via host variables, you can use the indicator variable to specify a NULL value. To do this, you must assign the indicator variable a negative value before the SQL statement is called. When the SQL statement is executed, the NULL value is used instead of the value of the host variable.