Categories:
String & Binary Functions (General)

CHR , CHAR

Converts a Unicode code point (including 7-bit ASCII) into the character that matches the input Unicode. If an invalid code point is specified, an error is returned.

CHAR is an alias for CHR.

See also:
ASCII , UNICODE

Syntax

CHR( <input> )

Arguments

input
The Unicode code point for which the character is returned.

Examples

These examples demonstrate the function behavior for valid Unicode code points, as well as invalid Unicode code points:

SELECT column1, CHR(column1)
FROM (VALUES(83), (33), (169), (8364), (0), (null));

+---------+--------------+
| COLUMN1 | CHR(COLUMN1) |
|---------+--------------|
|      83 | S            |
|      33 | !            |
|     169 | ©            |
|    8364 | €            |
|       0 |              |
|    NULL | NULL         |
+---------+--------------+

SELECT column1, CHR(column1)
FROM (VALUES(-1))v;

FAILURE: Invalid character code -1 in the CHR input

SELECT column1, CHR(column1)
FROM (VALUES(999999999999))v;

FAILURE: Invalid character code 999999999999 in the CHR input