OpenSQL Reference Guide > OpenSQL Reference Guide > Embedded OpenSQL > Host Language Variables > Indicator Variables and Character Data Retrieval
Was this helpful?
Indicator Variables and Character Data Retrieval
If OpenSQL retrieves a character string into a host variable that is too small to hold the string, the data is truncated to fit. (If the data was retrieved from the database, OpenSQL sets the sqlwarn1 field to “W”.) If the host variable has an associated indicator variable, the indicator is set to the original length of the data. For example, the following statement sets the variable, char_ind, to 6 because it is attempting to retrieve a 6‑character string into a 3‑byte host variable, char_3:
exec sql select 'abcdef' into :char_3:char_ind;
Note:  If a long varchar or long byte column is truncated into a host language variable, the indicator variable is set to 0. The maximum size of a long varchar or long byte column (2 GB) is too large to fit in an indicator variable.
Last modified date: 11/28/2023