Start of change

Unicode columns in EBCDIC tables

A single encoding scheme is used for all character and character string data in a table. An exception is that an EBCDIC table can contain one or more Unicode columns in addition to EBCDIC string columns.

An EBCDIC table can contain the following two types of Unicode columns:
Db2 12 or later Unicode columns
A Unicode column for character string data that was created in Db2 12 or later. The column is encoded in CCSID 1208 (UTF-8) or CCSID 1200 (UTF-16). Db2 12 or later Unicode columns are subject to fewer restrictions than Db2 11 Unicode columns.
Db2 11 Unicode columns
A Unicode column for character string data that was created in Db2 11. The column is encoded in CCSID 1208 (UTF-8).
Start of change

Restrictions on Db2 11 Unicode columns in EBCDIC tables

Db2 11 Unicode columns in EBCDIC tables must satisfy the following criteria:

  • The column must not be in the column-name list of a unique-constraint in a CREATE TABLE or ALTER TABLE statement.
  • The column must not be in the column-name list of a referential-constraint in a CREATE TABLE or ALTER TABLE statement.
  • The column must not be in the column-name list of a references-clause in a CREATE TABLE or ALTER TABLE statement.
  • The column must not be in the column-name list of an ORGANIZE BY HASH clause in a CREATE TABLE or ALTER TABLE statement.
  • The column must not be referenced in the CHECK(check-condition) clause in a CREATE TABLE or ALTER TABLE statement.
  • The column must not be referenced in the CHECK(check-condition) clause in a CREATE TABLE or ALTER TABLE statement.
  • The column can be the target of an ALTER COLUMN column-alteration clause in an ALTER TABLE statement only if the column is altered to the same data type, length, and CCSID. This change migrates a Db2 11 Unicode column to a Db2 12 Unicode column.
  • In a default-clause in a CREATE TABLE or ALTER TABLE statement, a value cannot follow the DEFAULT keyword.
  • The column cannot be used for column-name in a PARTITION BY RANGE clause in a CREATE TABLE or ALTER TABLE statement.
  • The column cannot be altered.
  • The column must not be referenced in a join-condition of a full outer join.
  • In a CREATE TABLE or ALTER TABLE statement, the column definition must not contain a FIELDPROC clause.
End of change

Restrictions on EBCDIC tables with Db2 11 Unicode columns

An EBCDIC table that contains Db2 11 Unicode columns Unicode columns must satisfy the following criteria:

  • The table name cannot be the table-name value in the LIKE clause of a CREATE TABLE statement.
  • In an as-result-table clause in a CREATE TABLE statement, if the from-clause in the fullselect is an EBCDIC table that contains Db2 11 Unicode columns, the outermost SELECT list of the fullselect cannot contain a mixture of EBCDIC columns and Db2 11 Unicode columns.
  • In a materialized-query-definition clause in a CREATE TABLE or ALTER TABLE statement, when ENABLE QUERY OPTIMIZATION is in effect, if the from-clause in the fullselect is an EBCDIC table that contains Db2 11 Unicode columns, the outermost SELECT list of the fullselect cannot contain a mixture of EBCDIC columns and Db2 11 Unicode columns.
  • The EDITPROC clause must not be specified in the CREATE TABLE statement.
  • The VALIDPROC clause must not be specified in the CREATE TABLE or ALTER TABLE statement.

Restriction on a created temporary table

When the LIKE clause is used to create a created temporary table, the table or view on which the created temporary table is based cannot be an EBCDIC table with a Db2 11 Unicode column.

Restriction on a declared temporary table

When the LIKE clause is used to create a declared temporary table, the table or view on which the declared temporary table is based cannot be an EBCDIC table with a Db2 11 Unicode column.

Restrictions on an index that has an index key with Db2 11 Unicode columns

  • A CREATE INDEX statement must not specify DESC, PADDED, or RANDOM for a Db2 11 Unicode column in an EBCDIC table.
  • An index that is defined on an EBCDIC table and is not an expression-based index must not include Db2 11 Unicode columns and Db2 12 Unicode columns. However, an expression-based index that is defined on an EBCDIC table can include Db2 11 Unicode columns and Db2 12 Unicode columns.

Restrictions on a table space that contains an EBCDIC table with Db2 11 Unicode columns

The CCSID of a table space that contains EBCDIC table with Db2 11 Unicode columns cannot be changed.

How the SQDA representnts Db2 11 Unicode columns are represented in EBCDIC tables

In an SQLVAR of an SQLDA after DESCRIBE or PREPARE INTO, Db2 11 Unicode columns in EBCDIC tables have these characteristics:

  • For a column that is defined with CCSID 1208, the SQLTYPE field reflects VARCHAR and the SQLDATA field contains 1208, even though the column might be recorded in the catalog as VARBINARY with CCSID 1208.
  • For a column that is defined with CCSID 1200, the SQLTYPE field reflects VARGRAPHIC and the SQLDATA field contains 1200, even though the column might be recorded in the catalog as VARBINARY with CCSID 1200.
End of change