Oracle 5.0 Reference Manual page 801

Table of Contents

Advertisement

10.1.7.2. Using
COLLATE
With the
COLLATE
may be used in various parts of SQL statements. Here are some examples:
COLLATE
• With
ORDER
SELECT k
FROM t1
ORDER BY k COLLATE latin1_german2_ci;
• With AS:
SELECT k COLLATE latin1_german2_ci AS k1
FROM t1
ORDER BY k1;
• With
GROUP
SELECT k
FROM t1
GROUP BY k COLLATE latin1_german2_ci;
• With aggregate functions:
SELECT MAX(k COLLATE latin1_german2_ci)
FROM t1;
• With DISTINCT:
SELECT DISTINCT k COLLATE latin1_german2_ci
FROM t1;
• With WHERE:
SELECT *
FROM t1
WHERE _latin1 'Müller' COLLATE latin1_german2_ci = k;
SELECT *
FROM t1
WHERE k LIKE _latin1 'Müller' COLLATE latin1_german2_ci;
• With HAVING:
SELECT k
FROM t1
GROUP BY k
HAVING k = _latin1 'Müller' COLLATE latin1_german2_ci;
10.1.7.3.
COLLATE
The
COLLATE
are equivalent:
x || y COLLATE z
x || (y COLLATE z)
10.1.7.4. Collations Must Be for the Right Character Set
Each character set has one or more collations, but each collation is associated with one and only one
character set. Therefore, the following statement causes an error message because the
collation is not legal with the
mysql>
SELECT _latin1 'x' COLLATE latin2_bin;
ERROR 1253 (42000): COLLATION 'latin2_bin' is not valid
for CHARACTER SET 'latin1'
in SQL Statements
clause, you can override whatever the default collation is for a comparison.
BY:
BY:
Clause Precedence
clause has high precedence (higher than
latin1
Collation Issues
[881]), so the following two expressions
||
character set:
781
latin2_bin

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents