Determining the CCSID of a string value in an SQL statement
Knowing the CCSID of a particular string value in an SQL statement helps you determine how Db2 evaluates the statement. This knowledge also helps you plan for character conversions. You can determine whether character conversion is necessary and what character conversions you need to define.
About this task
The CCSID that is associated with a string value depends on the SQL statement in which the data is referenced and the type of expression.
Procedure
To determine the CCSID of a string value in Db2, use one or more of the following techniques:
- Use the rules for determining the CCSID that is associated with string data, as specified in Encoding scheme and CCSID rules for strings.
- Use the DESCRIBE statement and then check the SQLDA. The SQLDA contains one SQLVAR entry for each column or host variable that is described. For string columns and parameters, look in the SQLDATA field of the appropriate SQLVAR entry to find the CCSID of that column or parameter. For more information, see SQLDATA field of the SQLDA.