# CHR

## Syntax

```sql
CHR(N)
```

## Description

`CHR()` interprets each argument N as an integer and returns a [VARCHAR(1)](https://mariadb.com/docs/server/reference/data-types/string-data-types/varchar) 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 [character\_set\_database](https://mariadb.com/docs/server/reference/system-tables/information-schema/information-schema-tables/information-schema-character_sets-table) and [collation\_database](https://mariadb.com/docs/server/reference/system-tables/information-schema/information-schema-tables/information-schema-collations-table) system variables.

`CHR()` is similar to the [CHAR()](https://mariadb.com/docs/server/reference/sql-functions/string-functions/char-function) function, but only accepts a single argument.

`CHR()` is available in all [sql\_modes](https://mariadb.com/docs/server/server-management/variables-and-modes/sql_mode).

## Examples

```sql
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' |
+---------+------+----------------------------------------+
```

## See Also

* [Character Sets and Collations](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets)
* [ASCII()](https://mariadb.com/docs/server/reference/sql-functions/string-functions/ascii) - Return ASCII value of first character
* [ORD()](https://mariadb.com/docs/server/reference/sql-functions/string-functions/ord) - Return value for character in single or multi-byte character sets
* [CHAR()](https://mariadb.com/docs/server/reference/sql-functions/string-functions/char-function) - Similar function which accepts multiple integers

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
