Oracle 5.0 Reference Manual page 804

Table of Contents

Advertisement

SET NAMES latin1;
SELECT utf8_bin_column FROM t2;
For binary string columns, no conversion occurs. For the preceding cases, the string value is copied
byte-wise.
Lettercase conversion. Collations provide information about lettercase of characters, so characters
in a nonbinary string can be converted from one lettercase to another, even for
ignore lettercase for ordering:
mysql>
SET NAMES latin1 COLLATE latin1_bin;
Query OK, 0 rows affected (0.02 sec)
mysql>
SELECT LOWER('aA'), UPPER('zZ');
+-------------+-------------+
| LOWER('aA') | UPPER('zZ') |
+-------------+-------------+
| aa
| ZZ
+-------------+-------------+
1 row in set (0.13 sec)
The concept of lettercase does not apply to bytes in a binary string. To perform lettercase conversion,
the string must be converted to a nonbinary string:
mysql>
SET NAMES binary;
Query OK, 0 rows affected (0.00 sec)
mysql>
SELECT LOWER('aA'), LOWER(CONVERT('aA' USING latin1));
+-------------+-----------------------------------+
| LOWER('aA') | LOWER(CONVERT('aA' USING latin1)) |
+-------------+-----------------------------------+
| aA
| aa
+-------------+-----------------------------------+
1 row in set (0.00 sec)
Trailing space handling in comparisons. Nonbinary strings have
collations, including
_bin
mysql>
SET NAMES utf8 COLLATE utf8_bin;
Query OK, 0 rows affected (0.00 sec)
mysql>
SELECT 'a ' = 'a';
+------------+
| 'a ' = 'a' |
+------------+
|
1 |
+------------+
1 row in set (0.00 sec)
For binary strings, all characters are significant in comparisons, including trailing spaces:
mysql>
SET NAMES binary;
Query OK, 0 rows affected (0.00 sec)
mysql>
SELECT 'a ' = 'a';
+------------+
| 'a ' = 'a' |
+------------+
|
0 |
+------------+
1 row in set (0.00 sec)
Trailing space handling for inserts and retrievals.
Values shorter than
characters are extended with spaces on insertion. For retrieval, trailing spaces
N
are removed.
columns store binary strings. Values shorter than
BINARY(N)
on insertion. For retrieval, nothing is removed; a value of the declared length is always returned.
Collation Issues
|
collations. Trailing spaces are insignificant in comparisons:
784
|
PADSPACE
columns store nonbinary strings.
CHAR(N)
bytes are extended with
N
collations that
_bin
behavior for all
bytes
0x00

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents