The CHAR data type

The CHAR data type stores character data in a fixed-length field. Data can be a string of single-byte or multibyte letters, numbers, and other characters that are supported by the code set of your database locale.

The following list summarizes how the choice of a locale affects the CHAR data type:
  • The size of a CHAR column is byte-based, not character-based.

    For example, if you define a CHAR column as CHAR(10), the column has a fixed length of 10 bytes, not 10 characters. If you want to store multibyte characters in a CHAR column, keep in mind that the total number of characters you can store in the column might be less than the total number of bytes you can store in the column. Make sure to define the byte size of the CHAR column so that it can hold enough characters for your purposes.

  • You can enter single-byte or multibyte characters in a CHAR column.

    The database locale must support the characters that you want to store in CHAR columns.

  • The database server sorts CHAR columns in code-set order, not in localized order.
  • Within a client application, always manipulate CHAR data in the CLIENT_LOCALE of the client application.

    The client application performs code-set conversion of CHAR data automatically if CLIENT_LOCALE differs from DB_LOCALE.