Previous |
Next |
There are three ways to represent a Unicode string literal in SQL or PL/SQL:
N'
string
'
Example: N'résumé'
.
Limitations: See "Avoiding Data Loss During Character-Set Conversion".
NCHR(
number
)
The SQL function NCHR
returns the character whose binary equivalent is number
in the national character set. The character returned has data type NVARCHAR2
.
Example: NCHR(36)
represents $
in the default national character set, AL16UTF16.
Limitations: Portability of the value of NCHR(
number
)
is limited to applications that use the same national character set.
UNISTR('
string
')
The SQL function UNISTR
converts string
to the national character set.
For portability and data preservation, Oracle recommends that string
contain only ASCII characters and Unicode encoding values. A Unicode encoding value has the form \xxxx
, where xxxx
is the hexadecimal value of a character code value in UCS-2 encoding format.
Example: UNISTR('G\0061ry')
represents 'Gary'
ASCII characters are converted to the database character set and then to the national character set. Unicode encoding values are converted directly to the national character set.
Oracle Database Globalization Support Guide
Oracle Database SQL Language Reference for more information about the NCHR
function
Oracle Database SQL Language Reference for more information about the UNISTR
function