Situations in which character conversion occurs

Character conversion is the process of converting data from one CCSID to another CCSID. This process can occur when data is transferred between a remote and local system or when data is manipulated within the local system.

Character conversion is more likely to occur when you are accessing data remotely because this situation often involves different platforms and encoding schemes. For example, in a client/server environment, a requester might send the values of host variables in SELECT predicates and INSERT column values to the current server. The current server might then send the values of result columns back to the requester. In either transaction, if the string data has a different representation at the sending and receiving systems, conversion occurs.

Conversion can also occur during string operations on the same system, as in the following examples:
  • A DECLARE VARIABLE statement specifies an overriding CCSID.
  • The SQLDA specifies an overriding CCSID for a string column.
  • You compare or combine data from multiple CCSIDs in an SQL statement.
  • You use SPUFI, which processes EBCDIC data, to insert data into a Unicode table.
  • The value of the ENCODING bind option (for static SQL statements) or the CURRENT APPLICATION ENCODING SCHEME special register (for dynamic SQL statements) is different than the encoding scheme of the data that is being inserted or retrieved.
  • An ASCII or EBCDIC application provides SQL statement text to DB2® in a PREPARE statement. DB2 converts the statement text to Unicode for parsing.