3. QUEL Data Types : Data Types : Character Data Types : Char Data Type
 
Share this page                  
Char Data Type
Char strings can contain any printing or non-printing character, and the null character ("\0"). In uncompressed tables, char strings are stored blank-padded to the declared length. (If the column is nullable, char columns require an additional byte of storage.) For example, if you enter "ABC" into a char(5) column, five bytes are stored, as follows:
"ABC  "
In compressed tables, trailing blanks are removed from char columns. In general, if your application must preserve trailing blanks, use varchar.
Leading and embedded blanks are significant when comparing char strings (unlike c strings). For example, the following char strings are different:
"A B C"
"ABC"
When retrieving char strings using the question mark (?) wildcard character, you must include any trailing blanks you want to match. For example, to retrieve the following char string:
"ABC "
the wildcard specification must also contain trailing blanks:
"???  "
Length is not significant when comparing char strings. For example, the following char strings are equal, even though the second string contains trailing blanks:
"ABC" = "ABC "
Character is a synonym for char.