Toad World® Forums

Knowledge Xpert: documentation is not correct


#1

I have been looking into the UNISTR function. Both Oracle 10g and 11g refer to
the NATIONAL CHARACTER SET (NLS) while Knowledge Xpert says DATABASE UNICODE
CHARACTER SET. But there are two character set. Both can be UNICODE and
different. The NLS character set and the character set.

Oracle says the following:

UNISTR

Syntax

Description of the illustration unistr.gif

Purpose

UNISTR takes as its argument a text literal or an expression that resolves to
character data and returns it in the national character set . The national
character set of the database can be either AL16UTF16 or UTF8. UNISTR provides
support for Unicode string literals by letting you specify the Unicode encoding
value of characters in the string. This is useful, for example, for inserting
data into NCHAR columns.

The Unicode encoding value has the form ‘\xxxx’ where ‘xxxx’ is the hexadecimal
value of a character in UCS-2 encoding format. Supplementary characters are
encoded as two code units, the first from the high-surrogates range (U+D800 to
U+DBFF), and the second from the low-surrogates range (U+DC00 to U+DFFF). To
include the backslash in the string itself, precede it with another backslash
(\).

For portability and data preservation, Oracle recommends that in the UNISTR
string argument you specify only ASCII characters and the Unicode encoding
values.

We noticed this because we got anomalous results until someone noticed NLS. Our
NLS character set is UTL16UTF16 and the character set is AL32UTF8

image002.gif
image001.gif