Appearance
Unicode Escape Sequences in String Constants
A Unicode escape string constant contains U&
or u&
directly before the opening quote, without any spaces. For example:
u&'any string'
U&'any string'
Within the quotes, you can specify Unicode characters in escaped form by typing a backslash followed by either the four-digit hexadecimal code-point number or a plus sign followed by a six-digit hexadecimal code-point number. For example:
premdb=# select U&'a\0062c\+000064' from sys.const;
?column?
----------
abcd
(1 row)
To use a different escape character instead of a backslash, specify it in a UESCAPE
clause after the string. For example:
premdb=# select U&'a$0062c$+000064' UESCAPE '$' from sys.const;
?column?
----------
abcd
(1 row)
The escape character can be any single character except for a hexadecimal digit, the plus sign, a single quote, a double quote, or a whitespace character.
To include the escape character in the string literally, type it twice.
Parent topic:SQL String Constants