UNICODE and NCHAR functions
UNICODE and NCHAR functions
UNICODE(ncharacter_expression) returns the Unicode value for the first character of the input expression.
NCHAR(integer) returns a character with the given integer Unicode value.
There are few examples.
SELECT ASCII('а'), UNICODE('а')
🚫
[[ error ]]
[[ column ]] |
---|
NULL [[ value ]] |
SELECT CHAR(ASCII('а')), CHAR(UNICODE('а'))
🚫
[[ error ]]
[[ column ]] |
---|
NULL [[ value ]] |
Here we try to recover a symbol by its code value. We get “а” and NULL. The NULL-value returns because the 1072 code value is absent in the usual code table.
SELECT CHAR(ASCII('а')), NCHAR(UNICODE('а'))
🚫
[[ error ]]
[[ column ]] |
---|
NULL [[ value ]] |
Now it’s all right, “a” in both cases. Finally,
SELECT NCHAR(ASCII('а'))
🚫
[[ error ]]
[[ column ]] |
---|
NULL [[ value ]] |