The CHAR function interprets each argument as an integer and returns a string consisting of the characters represented by those integer code values.
CHAR(<expr>[, <expr> ...] [USING <charset_name>])
| Parameter | Description |
|---|---|
<expr> | Integer code value to be converted to a character. Type: INT |
Returns VARCHAR type, a string composed of characters corresponding to the argument integer code values.
Special cases:
CHAR(15049882) is equivalent to CHAR(229, 164, 154)SELECT CHAR(68, 111, 114, 105, 115);
+--------------------------------------+ | CHAR(68, 111, 114, 105, 115) | +--------------------------------------+ | Doris | +--------------------------------------+
SELECT CHAR(15049882, 15179199, 14989469);
+--------------------------------------------+ | CHAR(15049882, 15179199, 14989469) | +--------------------------------------------+ | 多睿丝 | +--------------------------------------------+
SELECT CHAR(255);
+-------------------+ | CHAR(255) | +-------------------+ | NULL | +-------------------+
SELECT CHAR(NULL);
+------------+ | CHAR(NULL) | +------------+ | | +------------+