ALLBASE/SQL Reference Manual (36216-90216)
Chapter 7 211
Data Types
Value Comparisons
Value Comparisons
When you compare a CHAR and a VARCHAR string, ALLBASE/SQL pads the shorter
string with ASCII blanks to the length of the longer string. The two strings are equal if the
characters in the shorter string match those in the longer string and if the excess
characters in the longer string are all blank.
If a case sensitive CHAR column is compared to a CHAR column that is not case sensitive,
both columns are treated as case sensitive. If a string constant is compared to a column
that is not case sensitive, then the string constant is treated as not case sensitive.
Before comparing DECIMAL numbers having different scales, ALLBASE/SQL extends the
shorter scale with trailing zeroes to match the larger scale.
Items of type DATE, TIME, DATETIME, and INTERVAL can be compared only with items
of the same type, or with CHAR or VARCHAR strings in the correct format. All
comparisons are chronological, which means the point which is farthest from
'0000-01-01 00:00:00.000' is the greatest value. ALLBASE/SQL attempts to convert CHAR
or VARCHAR strings to the default date/time format before performing the comparison.
When you compare a BINARY and a VARBINARY hexadecimal string, ALLBASE/SQL
pads the shorter binary string with binary zeroes to the length of the longer string. When
comparing two BINARY or VARBINARY hexadecimal strings having different lengths,
ALLBASE/SQL compares the excess binary digits of the longer binary string with binary
zeroes. The two strings are equal if the binary digits in the shorter string match those in
the longer string and if the excess binary digits in the longer string are all binary zero.
The chapter "Search Conditions" provides more information on comparison operations.