Pages

Wednesday, July 20, 2011

PLSQL Query with unicode - nvarhcar2 - arabic

Assuming PL/SQL Developer uses Oracle Client 10.2 libraries, add a new Registry value with the name "ORA_NCHAR_LITERAL_REPLACE" and the string data "TRUE" in the Registry key corresponding to the Oracle Client (HKLM\SOFTWARE\ORACLE\KEY_+Home name+)
NLS_LANG=GERMAN_GERMANY.UTF8
ORA_NCHAR_LITERAL_REPLACE=TRUE

SQL> SELECT VALUE
 
2    FROM nls_database_parameters
 
3   WHERE parameter = 'NLS_NCHAR_CHARACTERSET'; 
If you are using oracle client, and would like to include unicode characters in the CommandText, you should add the folloing line to the start of your application:
System.Environment.SetEnvironmentVariable("ORA_NCHAR_LITERAL_REPLACE", "TRUE"); 

This will allow you, in case you need it, to use the following syntax:
command.CommandText = "INSERT into UNICODEDATA (ID, UNICODESTRING) Values (11, N'Τι κάνεις;')"; 

Oracle white paper: Migration to Unicode Datatypes for Multilingual Databases and Applications. http://www.oracle.com/technology/tech/globalization/pdf/TWP_NCHAR_MIGRATION_10gR2.pdf.

No comments:

Post a Comment