Indicate truncated values
When an SQL statement returns a non-null value into a host-variable
character array, it might truncate the value to fit into the variable.
If you define an indicator variable for this host variable, HCL
OneDB™ ESQL/C:
- Sets the SQLSTATE variable to "01004" to signal the occurrence
of truncation.
For more information about SQLSTATE, see ids_esqlc_0397.html#ids_esqlc_0397.) HCL OneDB ESQL/C also sets sqlwarn1 of the sqlca.sqlwarn structure to
W
. - Sets the associated indicator variable equal to the size in bytes of the SQL host variable before truncation.
If you do not define an indicator variable, HCL OneDB ESQL/C still sets SQLSTATE and sqlca.sqlwarn to signal the truncation. However, your program has no way to determine how much data was truncated.
If the database server returns a value that is not truncated or null, HCL OneDB ESQL/C sets the indicator variable to 0.