NCharLiteral
database parameter
Description
Specifies whether the NChar literal replacement feature in the
Oracle client is enabled. This feature replaces string literals on the
client that are prefaced with the letter N with an internal format. The
internal format is decoded to Unicode by the database server when the
statement is executed.
When to specify NCharLiteral
You must specify the NCharLiteral parameter before connecting to
the database.
Applies to
O10 Oracle 10g
ORA Oracle (for 11g and later)
Syntax
|
1 |
NCharLiteral=value |
|
Parameter |
Description |
|---|---|
|
value |
Specifies whether PowerBuilder replaces string
|
Default value
NCharLiteral=’No’
Usage
The NCharLiteral database parameter requires Oracle 10.2 or higher
on both the client and the database server.
By default, in a SQL statement, the text of any literal is encoded
in the same character set as the rest of the statement. The character
set on the client is determined by the client character set defined in
NLS_LANG. When the statement is executed, the character set on the
client is converted to the character set on the database server.
Data in string literals is lost in the conversion if the character
set on the database server does not contain the characters used on the
client. NChar string literals are most affected by this issue because
they are designed to be independent of the character set on the database
server.
To avoid this data loss, add the letter N before string literals
that should be replaced with an internal format and set the NCharLiteral
database parameter to ‘Yes’. This setting causes the Oracle client to
encode all literals prefixed with N in statements on the client with an
internal format. The database server decodes the literals to Unicode
when the statement is executed.
For example, when NCharLiteral is set to ‘Yes’, the string “some
unicode data” in the following SQL statement is transferred from the
client to the server with no data loss:
|
1 |
insert into table1 (id, ncharcol) values(1, N'some unicode data') |
Setting NCharLiteral to ‘Yes’ has no effect on DataWindow
functions.
Examples
To specify that string literals prefixed by the letter N should be
replaced with an internal format on the client:
-
Database profile
Select the NChar Literal box on the Connection page in the
Database Profile Setup dialog box. -
Application
Type the following in code:
1SQLCA.DBParm="NCharLiteral=1"