(mysql.info.gz) Charset-result
Info Catalog
(mysql.info.gz) Charset-operations
(mysql.info.gz) Charset-operations
(mysql.info.gz) Charset-CONVERT
10.4.1 Result Strings
---------------------
MySQL has many operators and functions that return a string. This
section answers the question: What is the character set and collation
of such a string?
For simple functions that take string input and return a string result
as output, the output's character set and collation are the same as
those of the principal input value. For example, `UPPER(X)' returns a
string whose character string and collation are the same as that of X.
The same applies for `INSTR()', `LCASE()', `LOWER()', `LTRIM()',
`MID()', `REPEAT()', `REPLACE()', `REVERSE()', `RIGHT()', `RPAD()',
`RTRIM()', `SOUNDEX()', `SUBSTRING()', `TRIM()', `UCASE()', and
`UPPER()'. (Also note: The `REPLACE()' function, unlike all other
functions, ignores the collation of the string input and performs a
case-insensitive comparison every time.)
For operations that combine multiple string inputs and return a single
string output, the "aggregation rules" of standard SQL apply:
* If an explicit `COLLATE X' occurs, then use `X'
* If an explicit `COLLATE X' and `COLLATE Y' occur, then error
* Otherwise, if all collations are `X', then use `X'
* Otherwise, the result has no collation
For example, with `CASE ... WHEN a THEN b WHEN b THEN c COLLATE X END',
the resultant collation is `X'. The same applies for `CASE', `UNION',
`||', `CONCAT()', `ELT()', `GREATEST()', `IF()', and `LEAST()'.
For operations that convert to character data, the character set and
collation of the strings that result from the operations are defined by
the `character_set_connection' and `collation_connection' system
variables. This applies for `CAST()', `CHAR()', `CONV()', `FORMAT()',
`HEX()', and `SPACE()'.
Info Catalog
(mysql.info.gz) Charset-operations
(mysql.info.gz) Charset-operations
(mysql.info.gz) Charset-CONVERT
automatically generated byinfo2html