> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/string-functions/chr.md).

# CHR

## Syntax

```bnf
CHR(N)
```

## Description

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

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

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

## 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](/docs/server/reference/data-types/string-data-types/character-sets.md)
* [ASCII()](/docs/server/reference/sql-functions/string-functions/ascii.md) - Return ASCII value of first character
* [ORD()](/docs/server/reference/sql-functions/string-functions/ord.md) - Return value for character in single or multi-byte character sets
* [CHAR()](/docs/server/reference/sql-functions/string-functions/char-function.md) - Similar function which accepts multiple integers

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

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions/string-functions/chr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
