Versions available for this page: CUBRID 8.2.1 | CUBRID 8.3.0 | CUBRID 8.3.1 | CUBRID 8.4.0 | CUBRID 8.4.1 | CUBRID 8.4.3 | CUBRID 9.0.0 |
Fixed-length character strings are represented as NCHAR(n), where where n is the number of characters. Character strings that can be stored in this data type must belong to the character sets explained earlier. If n is not specified, the length is set to the default value 1. When the length of a character string exceeds n, the exceeding characters are truncated if they are space characters, or processed as an error otherwise. When a character string shorter than n is stored, the trailing space is filled with space characters. In some language character sets, one character is stored as more than one byte. Therefore, n must not be considered as the byte size.
The locale used by NCHAR is the locale of the operating system, or is specified by the CUBRID_LANG environment variable.
NCHAR(n), NATIONAL CHAR(n) and NATIONAL CHARACTER(n) can be used interchangeably.
If you specify N'Härder' as NCHAR(8), 'Härder ' is stored (a 6-character string plus two space characters).
If you specify N'Härder ' as NCHAR(6), 'Härder' is stored (a 6-character string; two space characters are truncated).
If you specify N'Härder' as NCHAR, an error occurs (because the length of the character string is greater than the default value 1).
If you specify 'pacesetter' as NCHAR(12), an error occurs (that is, if a non-national string is specified for an attribute declared as a national character string).