Unicode String Literals
Syntax
U&'characters' [ UESCAPE '<Unicode escape character>' ]
Parameters
characters |
Arbitrary sequence of UTF-8 characters bounded by single quotes (') |
Unicode escape character |
A single character from the source language character set other than a hexit, plus sign (+), quote ('), double quote (''), or white space |
Using Standard Conforming Strings
With StandardConformingStrings
enabled, Vertica supports SQL standard Unicode character string literals (the character set is UTF-8 only).
Before you enter a Unicode character string literal, enable standard conforming strings in one of the following ways.
- To enable for all sessions, update the
StandardConformingStrings
configuration parameter. See Configuration Parameters in the Administrator's Guide. - To treat backslashes as escape characters for the current session, use the SET STANDARD_CONFORMING_STRINGS statement.
See also Extended String Literals.
Examples
To enter a Unicode character in hexadecimal, such as the Russian phrase for "thank you, use the following syntax:
=> SET STANDARD_CONFORMING_STRINGS TO ON; => SELECT U&'\0441\043F\0430\0441\0438\0431\043E' as 'thank you'; thank you ----------- спасибо (1 row)
To enter the German word mude
(where u
is really u-umlaut) in hexadecimal:
=> SELECT U&'m\00fc
de';
?column?
----------
müde
(1 row)
=> SELECT 'ü';
?column?
----------
ü
(1 row)
To enter the LINEAR B IDEOGRAM B240 WHEELED CHARIOT
in hexadecimal:
=> SELECT E'\xF0\x90\x83\x8C'; ?column? ---------- (wheeled chariot character) (1 row)
Note: Not all fonts support the wheeled chariot character.