The VARCHAR data type

The VARCHAR data type stores character strings of up to 255 bytes in a variable-length field. Data can consist of letters, numbers, and symbols. CHARACTER VARYING is handled the same as VARCHAR.

The following list summarizes how the choice of a locale affects the VARCHAR data type:
  • The maximum size and minimum reserved space for a VARCHAR column are byte based, not character based.

    For example, if you define a VARCHAR column as VARCHAR(10,6), the column has a maximum length of 10 bytes and a minimum reserved space of 6 bytes. If you want to store multibyte characters in a VARCHAR 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 maximum byte size of the VARCHAR column so that it can hold enough characters for your purposes.

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

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

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

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