The NCHAR data type
The NCHAR data type stores character data in a fixed-length field as a string of single-byte or multibyte letters, numbers, and other characters that are supported by the code set of your database locale.
- Element
- Description
- size
- Specifies the number of bytes in the column. The total length of an NCHAR column cannot exceed 32,767 bytes. If you do not specify size, the default is NCHAR(1).
Because the length of this column is fixed, when the database server retrieves or sends an NCHAR
value, it transfers exactly size bytes of data. If the length of a character
string is shorter than size, the database server extends the string with
spaces to make up the size bytes. If the database is ANSI and the length of a
character string is longer than the column size then the insert fails and this error
is returned:
-1279: Value exceeds string column length.
If the length of the character string is longer than the size of the
column, the database server truncates the value if the database is non-ANSI. No
warning is generated when this truncation occurs. Note: Starting with Informix server versions 14.10.xC13, 15.0.0.2.3 and 15.0.1.x, in
case of a non-ANSI database, truncation error -1279 can be requested (if the
inserted value is longer than the maximum size of the column) using STRING_TRUNCATE_ERROR onconfig parameter or STRING_TRUNCATE_ERROR session environment option.
If the string is longer than size bytes, the database server truncates
the string.