Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

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 | 

NCHAR(n)

Description

NCHAR(n) is used to store non-English character strings. It can be used only for character sets supported by CUBRID described above. n is the number of characters. If n is omitted, the length is specified as the default value 1. When the length of a character string exceeds n, they are truncated. When character string which is shorter than n is stored, whitespace characters are used to fill up the  space.

To store a Korean character string as a national character string type, you must set the locale of the operating system to Korean, or set the value of the CUBRID_LANG environment variable to ko_KR.euckr before creating the table.

Note In the earlier versions of CUBRID 9.0, n represents bite length, not the number of characters.

Remark
  • n is an integer between 1 and 536,870,911.
  • The number of national character sets that can be used in a single database is set to be one. For example, 8-bit ISO 8889-1 (Latin-1) and EUC code sets cannot be used simultaneously in the same database.
  • An error occurs if a non-national character string (whether it is fixed-length or variable-length) is specified for an attribute declared as a national character string.
  • Using two different character code sets at once also causes an error.
Example

If you specify ‘큐브리드’ as NCHAR(5) in the EUC-KR encoding, it is processed normally.

If you specify '큐브리드' as NCHAR(5) and then use the CHAR_LENGTH() function in the EUC-KR encoding, 5 is stored.

If you specify '큐브리드' as NCHAR(5) in the utf-8 encoding, an error occurs (utf-8 character set is not supported).