Coercing Data Types
Go Up to Understanding the XSQLDA
Sometimes when processing DSQL input parameters and select-list items, it is desirable or necessary to translate one data type to another. This process is referred to as data type coercion. For example, data type coercion is often used when parameters or select-list items are of type VARCHAR
. The first two bytes of VARCHAR
data contain string length information, while the remainder of the data is the string to process. By coercing the data from SQL_VARYING
to SQL_TEXT
, data processing can be simplified.
Coercion can only be from one compatible data type to another. For example, SQL_VARYING
to SQL_TEXT
, or SQL_SHORT
to SQL_LONG
.