All pages
Powered by GitBook
1 of 1

Loading...

CHAR Function

Return the character for each integer passed. This function interprets arguments as integer ASCII values and returns a string of those characters.

Syntax

Description

CHAR() interprets each argument as an and returns a string consisting of the characters given by the code values of those integers. NULL values are skipped. By default, CHAR() returns a binary string. To produce a string in a given , use the optional USING clause:

If USING is given and the result string is illegal for the given character set, a warning is issued. Also, if strict is enabled, the result from CHAR() becomes NULL.

Examples

See Also

  • - Return ASCII value of first character

  • - Return value for character in single or multi-byte character sets

  • - Similar, Oracle-compatible, function

This page is licensed: GPLv2, originally from

CHAR(N,... [USING charset_name])
INT
character set
SQL mode
Character Sets and Collations
ASCII()
ORD()
CHR
fill_help_tables.sql
SELECT CHARSET(CHAR(0x65)), CHARSET(CHAR(0x65 USING utf8));
+---------------------+--------------------------------+
| CHARSET(CHAR(0x65)) | CHARSET(CHAR(0x65 USING utf8)) |
+---------------------+--------------------------------+
| binary              | utf8                           |
+---------------------+--------------------------------+
SELECT CHAR(77,97,114,'105',97,'68',66);
+----------------------------------+
| CHAR(77,97,114,'105',97,'68',66) |
+----------------------------------+
| MariaDB                          |
+----------------------------------+

SELECT CHAR(77,77.3,'77.3');
+----------------------+
| CHAR(77,77.3,'77.3') |
+----------------------+
| MMM                  |
+----------------------+
1 row in set, 1 warning (0.00 sec)

Warning (Code 1292): Truncated incorrect INTEGER value: '77.3'