String Comparison Functions
895
This function is multi-byte safe.
•
UCASE(str)
[895]
UCASE()
[895]
is a synonym for
UPPER()
[895]
.
•
UNHEX(str)
[895]
For a string argument
str
,
UNHEX(str)
[895]
performs the inverse operation of
HEX(str)
[889]
. That is, it interprets each pair of characters in the argument as a hexadecimal
number and converts it to the character represented by the number. The return value is a binary
string.
mysql>
SELECT UNHEX('4D7953514C');
-> 'MySQL'
mysql>
SELECT 0x4D7953514C;
-> 'MySQL'
mysql>
SELECT UNHEX(HEX('string'));
-> 'string'
mysql>
SELECT HEX(UNHEX('1267'));
-> '1267'
The characters in the argument string must be legal hexadecimal digits:
'0'
..
'9'
,
'A'
..
'F'
,
'a'
..
'f'
. If the argument contains any nonhexadecimal digits, the result is
NULL
:
mysql>
SELECT UNHEX('GG');
+-------------+
| UNHEX('GG') |
+-------------+
| NULL |
+-------------+
A
NULL
result can occur if the argument to
UNHEX()
[895]
is a
BINARY
column, because values
are padded with 0x00 bytes when stored but those bytes are not stripped on retrieval. For example,
'41'
is stored into a
CHAR(3)
column as
'41 '
and retrieved as
'41'
(with the trailing pad space
stripped), so
UNHEX()
[895]
for the column value returns
'A'
. By contrast
'41'
is stored into
a
BINARY(3)
column as
'41\0'
and retrieved as
'41\0'
(with the trailing pad
0x00
byte not
stripped).
'\0'
is not a legal hexadecimal digit, so
UNHEX()
[895]
for the column value returns
NULL
.
For a numeric argument
N
, the inverse of
HEX(N)
[889]
is not performed by
UNHEX()
[895]
. Use
CONV(HEX(N),16,10)
[909]
instead. See the description of
HEX()
[889]
.
•
UPPER(str)
[895]
Returns the string
str
with all characters changed to uppercase according to the current character
set mapping. The default is
latin1
(cp1252 West European).
mysql>
SELECT UPPER('Hej');
-> 'HEJ'
See the description of
LOWER()
[890]
for information that also applies to
UPPER()
[895]
, such
as information about how to perform lettercase conversion of binary strings (
BINARY
,
VARBINARY
,
BLOB
) for which these functions are ineffective.
This function is multi-byte safe.
12.5.1. String Comparison Functions
Table 12.8. String Comparison Operators
Name
Description
LIKE
[896]
Simple pattern matching
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...