3. Understanding SQL Data Types : Literals : String Literals : Unicode Literals
 
Share this page                  
Unicode Literals
To specify a Unicode literal value within a non-Unicode command string (for example, in a query entered into the terminal monitor), the Unicode literal notation can be used. A Unicode literal is a sequence of ASCII characters intermixed with escaped sequence of hex digits, all enclosed in quotes and preceded by U&. The escape character \ precedes sets of 4 hex digits that are treated as Unicode codepoints from Plane 0 (the Basic Multilingual Plane) and the escape sequence \+ precedes sequences of 6 hex digits that are treated as codepoints from the Supplementary Plane. Note that this may require a leading 0. For example:
U&’Hello\202Fworld\+029E71’
In this string, Hello is converted to the equivalent Unicode codepoints, the hex digits 202F represent codepoint U+202F (the narrow non-breaking space), world is converted to the equivalent Unicode codepoints, and the hex digits 029E71 represent codepoint U+29E71 (the Chinese ideograph chù from Plane 2). The resulting literal is the concatenation of the converted Unicode components.
The notation N'x' can be used as an alternative to the U&'x' notation.