The CHR function converts n to one or more equivalent characters. The return value is relevant to the character sets of the current system.
Syntax
CHR ( n )
Parameters
| Parameter | Value range |
|---|---|
| n | 0~4294967295 |
Return type
The return value is relevant to the character sets of the current system. The character sets that ApsaraDB for OceanBase supports are UTF-8, UTF-16, GBK, and GB18030.
Examples
Decimal (25700) > Hexadecimal (0x6464) > UTF-8 encoding (dd)
Execute the following statement:
SELECT CHR(25700) AS str FROM DUAL;
The following query result is returned:
+------+
| STR |
+------+
| dd |
+------+
Decimal (50318) > Hexadecimal (0xC48E) > UTF-8 encoding (Ď)
Execute the following statement:
SELECT CHR(50318) AS str FROM DUAL;
The following query result is returned:
+------+
| STR |
+------+
| Ď |
+------+
Decimal > UTF-8 encoding
SELECT CHR(67)||CHR(65)||CHR(84) "Dog" FROM DUAL;
The following query result is returned:
+------+
| Dog |
+------+
| CAT |
+------+