If you want your application program to process NULL values or DEFAULT values, or if values might be truncated when they are exchanged between host variables and the database, then you must specify an indicator variable as well as the host variable in the embedded SQL statement.
Observe the rules for indicator variables.
The value of an indicator variable is called an indicator value, and performs the following tasks:
· It provides information on whether the corresponding host variables have been processed correctly. For this reason, query the indicator value after the SQL statement has been processed.
· It is used to transfer NULL values to the database instance.
· It is used to transfer DEFAULT values to the database instance.
· It is used in GETVAL statements and PUTVAL statements to ignore individual LONG columns.
If a SELECT statement or a FETCH statement specifies that values are transferred from columns in which NULL values can appear, then you must specify an indicator variable. Otherwise the C/C++ precompiler writes a warning when the precompiler runs with the precompiler option check, and you see an error message when you select a NULL value at runtime ( sqlcode = -809).
In dynamic SQL statements with a descriptor, the hostindicator component of an sqlvar entry performs the same task as an indicator variable.