2. Language Elements : Data Types : Character Data Types : Varchar Data Types
 
Share this page                  
Varchar Data Types
Varchar strings are variable-length strings. The varchar data type can contain any character, including non-printing characters and the ASCII null character ('\0').
Except when comparing with char data, blanks are significant in the varchar data type. For example, the following two varchar strings are not considered equal:
'the store is closed'
and
'thestoreisclosed'
If the strings being compared are unequal in length, the shorter string is padded with trailing blanks until it equals the length of the longer string.
For example, consider the following two strings:
'abcd\001'
where:
'\001' represents one ASCII character (ControlA)
and
'abcd'
If they are compared as varchar data types, then
'abcd' > 'abcd\001'
because the blank character added to 'abcd' to make the strings the same length has a higher value than ControlA ('\040' is greater than '\001').