CHAR()

Overview

Returns a string consisting of characters defined by the given code values.

USAGE

CHAR(expr[, expr] ... [USING charset])

Argument Name

Description

expr

One or more comma-separated integer expressions

USING charset

The optional USING charset clause specifies the name of the character set to use for the return value

DETAILS

CHAR() is a string function that returns a string consisting of characters represented by the code values of the comma-separated integers supplied as the arguments.

The mapping of integers to characters can be found in standard ASCII, UNICODE, etc. charts.

The return value is a binary string by default.

The optional USING clause may be used to generate a string in a specific character set.

The number of result bytes generated for each input value depends on the character set and how large the input values are. An input value larger than 255 will always result in multiple bytes.

Any NULL values in the input arguments are ignored.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT CHAR(72, NULL, 105, 33);
+-------------------------+
| CHAR(72, NULL, 105, 33) |
+-------------------------+
| Hi!                     |
+-------------------------+
SELECT CHAR(64, 76);
+--------------+
| CHAR(64, 76) |
+--------------+
| @L           |
+--------------+
SELECT CHAR(77, '97', 114, 105, 97, '68', 66);
+----------------------------------------+
| CHAR(77, '97', 114, 105, 97, '68', 66) |
+----------------------------------------+
| MariaDB                                |
+----------------------------------------+
SELECT HEX(CHAR(1,1,0)) AS Ex1,
       HEX(CHAR(260)) AS Ex2;
+--------+------+
| Ex1    | Ex2  |
+--------+------+
| 010100 | 0104 |
+--------+------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES