Entering Unicode Characters

Optional syntax allows you to specify arbitrary Unicode characters.

If a character literal is immediately preceded by U& or u& (with no intervening white space), the parser recognizes escape sequences within the literal. An escape sequence of the form \xxxx (where xxxx represents four hexadecimal digits) is replaced with the Unicode character whose scalar value is xxxx. Similarly, an escape sequence of the form \+yyyyyy is replaced with the Unicode character whose scalar value is yyyyyy. The escape sequence \\ is replaced by a single \. For example, the following is equivalent to:


Example of how Japanese text appears.
select * from mytable where unichar_column = U&'\4e94'

The U& or u& prefix simply enables the recognition of escapes. The datatype of the literal is chosen solely on the basis of representability. Thus, for example, the following two queries are equivalent:

select * from mytable where char_column = 'A'
select * from mytable where char_column = U&'\0041'

In both cases, the datatype of the character literal is char, since “A” is an ASCII character, and ASCII is a subset of all SAP-supported server character sets.

The U& and u& prefixes also work with the double-quoted character literals and for quoted identifiers. However, quoted identifiers must be representable in the server’s character set, insofar as all database objects are identified by names in system tables, and all such names are of datatype char.