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 | 



A fixed-length character string is represented as CHAR(n), in which n represents the number of characters. If n is not specified, the value is specified as 1, default value.

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 trailing space.

CHAR(n) and CHARACTER(n) are used interchangeably.

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

  • The CHAR data type is always based on the ISO 8859-1 Latin character set.
  • n is an integer between 1 and 1,073,741,823 (1G).
  • Empty quotes (' ') are used to represent a blank string. In this case, the return value of the LENGTH function is not 0, but is the fixed length defined in CHAR(n). That is, if you enter a blank string into a column with CHAR(10), the LENGTH is 10; if you enter a blank value into a CHAR with no length specified, the LENGTH is the default value 1.
  • Space characters used as filling characters are considered to be smaller than any other characters, including special characters.

If you specify 'pacesetter' as CHAR(12), 'pacesetter ' is stored (a 10-character string plus two whitespace characters).

If you specify 'pacesetter ' as CHAR(10), 'pacesetter' is stored (a 10-character string; two whitespace characters are truncated).

If you specify 'pacesetter' as CHAR(4), 'pace' is stored (truncated as the length of the character string is greater than 4).

If you specify 'p ' as CHAR, 'p' is stored (if n is not specified, the length is set to the default value 1).