Oracle 5.0 Reference Manual page 969

Table of Contents

Advertisement

SIGNED [INTEGER]
TIME
UNSIGNED [INTEGER]
produces a string with the
BINARY
Types"
for a description of how this affects comparisons. If the optional length
VARBINARY
given,
causes the cast to use no more than
BINARY(N)
5.0.17, values shorter than
[886]
causes the cast to use no more than
CHAR(N)
The
type is available as of MySQL 5.0.8.
DECIMAL
[948]
and
CAST()
CONVERT(... USING ...)
form of
[948]
CONVERT()
[948]
with
CONVERT()
transcoding names are the same as the corresponding character set names. For example, this
statement converts the string
character set:
utf8
SELECT CONVERT('abc' USING utf8);
Normally, you cannot compare a
because binary strings have no character set, and thus no concept of lettercase. To perform a case-
insensitive comparison, use the
Comparisons of the result use the string collation. For example, if the character set of the result has a
case-insensitive collation, a
SELECT 'A' LIKE
CONVERT(blob_col
To use a different character set, substitute its name for
To specify a particular collation for the converted string, use a
[948]
call, as described in
CONVERT()
use latin1_german1_ci:
SELECT 'A' LIKE
CONVERT(blob_col
FROM tbl_name;
[948]
can be used more generally for comparing strings that are represented in different
CONVERT()
character sets.
[890]
(and
LOWER()
UPPER()
VARBINARY, BLOB). To perform lettercase conversion, convert the string to a nonbinary string:
mysql>
SET @str = BINARY 'New York';
mysql>
SELECT LOWER(@str), LOWER(CONVERT(@str USING latin1));
+-------------+-----------------------------------+
| LOWER(@str) | LOWER(CONVERT(@str USING latin1)) |
+-------------+-----------------------------------+
| New York
| new york
+-------------+-----------------------------------+
The cast functions are useful when you want to create a column with a specific type in a
statement:
TABLE ... SELECT
CREATE TABLE new_table SELECT CAST('2000-01-01' AS DATE);
The functions also can be useful for sorting
columns occurs using the internal numeric values. Casting the values to
Cast Functions and Operators
data type. See
BINARY
bytes are padded with
N
is ODBC syntax.
is used to convert data between different character sets. In MySQL,
USING
in the default character set to the corresponding string in the
'abc'
value or other binary string in case-insensitive fashion
BLOB
[948]
CONVERT()
[896]
operation is not case sensitive:
LIKE
USING latin1) FROM tbl_name;
Section 10.1.9.2,
USING latin1) COLLATE latin1_german1_ci
[895]) are ineffective when applied to binary strings (BINARY,
ENUM
949
Section 11.1.6.2, "The
bytes of the argument. As of MySQL
N
bytes to a length of N.
0x00
characters of the argument.
N
[948]
are standard SQL syntax. The
function to convert the value to a nonbinary string.
in the preceding statement.
latin1
clause following the
COLLATE
"CONVERT()
and
|
columns in lexical order. Normally, sorting of
CHAR
and
BINARY
is
N
non-USING
CAST()". For example, to
CREATE
ENUM
results in a lexical sort:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents