Oracle 5.0 Reference Manual page 907

Table of Contents

Advertisement

-> 'MMM'
As of MySQL 5.0.15,
result bytes. For example,
[886]
CHAR(256*256)
mysql>
SELECT HEX(CHAR(1,0)), HEX(CHAR(256));
+----------------+----------------+
| HEX(CHAR(1,0)) | HEX(CHAR(256)) |
+----------------+----------------+
| 0100
| 0100
+----------------+----------------+
mysql>
SELECT HEX(CHAR(1,0,0)), HEX(CHAR(256*256));
+------------------+--------------------+
| HEX(CHAR(1,0,0)) | HEX(CHAR(256*256)) |
+------------------+--------------------+
| 010000
+------------------+--------------------+
By default,
[886]
CHAR()
the optional
clause:
USING
mysql>
SELECT CHARSET(CHAR(0x65)), CHARSET(CHAR(0x65 USING utf8));
+---------------------+--------------------------------+
| CHARSET(CHAR(0x65)) | CHARSET(CHAR(0x65 USING utf8)) |
+---------------------+--------------------------------+
| binary
+---------------------+--------------------------------+
If
is given and the result string is illegal for the given character set, a warning is issued. Also,
USING
if strict SQL mode is enabled, the result from
Before MySQL 5.0.15,
the
clause is unavailable. In addition, each argument is interpreted modulo 256, so
USING
[886]
and
CHAR(256)
CHAR_LENGTH(str)
Returns the length of the string str, measured in characters. A multi-byte character counts as a
single character. This means that for a string containing five 2-byte characters,
returns 10, whereas
CHARACTER_LENGTH(str)
CHARACTER_LENGTH()
CONCAT(str1,str2,...)
Returns the string that results from concatenating the arguments. May have one or more arguments.
If all arguments are nonbinary strings, the result is a nonbinary string. If the arguments include any
binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary
string form; if you want to avoid that, you can use an explicit type cast, as in this example:
SELECT
CONCAT(CAST(int_col
[887]
returns
CONCAT()
mysql>
SELECT CONCAT('My', 'S', 'QL');
-> 'MySQL'
mysql>
SELECT CONCAT('My', NULL, 'QL');
-> NULL
mysql>
SELECT CONCAT(14.3);
-> '14.3'
For quoted strings, concatenation can be performed by placing the strings next to each other:
String Functions
[886]
arguments larger than 255 are converted into multiple
CHAR()
[886]
CHAR(256)
is equivalent to
CHAR(1,0,0)
|
| 010000
|
returns a binary string. To produce a string in a given character set, use
| utf8
[886]
returns a string in the connection character set and
CHAR()
[886]
CHAR(256*256)
[887]
[887]
CHAR_LENGTH()
[887]
[887]
is a synonym for
[887]
AS CHAR), char_col);
if any argument is NULL.
NULL
887
is equivalent to
CHAR(1,0)
[886]:
|
[886]
becomes NULL.
CHAR()
both are equivalent to
returns 5.
[887].
CHAR_LENGTH()
[886], and
[886].
CHAR(0)
[890]
LENGTH()

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents