SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-5
Collations
Collations
A collation is an object that contains rules for a collating sequence (the sequence in
which characters are ordered for sorting), case, and character class and character
string equivalence.
Every character set has a collation. See Character Sets on page 6-3. To be compared,
character strings must be from the same character set. When two strings are
compared, the comparison is made with a temporary copy of the shorter string that has
been padded on the right with blanks to have the same length as the longer string.
You create an SQL/MP collation with the SQL/MP CREATE COLLATION statement. A
collation name must be a Guardian name. For more information, see the SQL/MP
Reference Manual.
You cannot use SQL/MP collations on SQL/MX tables and you cannot create collations
for SQL/MX tables. SQL/MX Release 2.x supports only the DEFAULT collation.
DEFAULT is based on binary ordering and is the default collating sequence for CHAR
and NCHAR data types.
Binary collation is a collating sequence based on binary ordering. A binary collation
comparison of two equal length strings, s1 and s2, compares the values of the
corresponding characters of s1 and s2 until it finds a difference. If a difference is found
and the differing character value of s1 is less than that of s2, s1 is considered to come
before s2. If there is no difference, s1 is considered equal to s2. Otherwise, s1 comes
after s2. If the two strings are not equal in length, the shorter one is padded with
spaces in the corresponding character set.
Comparison of two identical strings associated with the same character set will always
be evaluated as equal by the DEFAULT collation. However, the DEFAULT collation
does not necessarily yield sorting orders that are culturally correct.