All pages
Powered by GitBook
1 of 1

Loading...

CHR

Return the character for a specific ASCII value. This function is similar to CHAR() but accepts a single integer argument.

Syntax

CHR(N)

Description

CHR() interprets each argument N as an integer and returns a string consisting of the character given by the code values of the integer. The character set and collation of the string are set according to the values of the and system variables.

CHR() is similar to the function, but only accepts a single argument.

CHR() is available in all .

Examples

See Also

  • - Return ASCII value of first character

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

  • - Similar function which accepts multiple integers

This page is licensed: CC BY-SA / Gnu FDL

VARCHAR(1)
character_set_database
collation_database
CHAR()
sql_modes
Character Sets and Collations
ASCII()
ORD()
CHAR()
SELECT CHR(67);
+---------+
| CHR(67) |
+---------+
| C       |
+---------+

SELECT CHR('67');
+-----------+
| CHR('67') |
+-----------+
| C         |
+-----------+

SELECT CHR('C');
+----------+
| CHR('C') |
+----------+
|          |
+----------+
1 row in set, 1 warning (0.000 sec)

SHOW WARNINGS;
+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect INTEGER value: 'C' |
+---------+------+----------------------------------------+