Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Wrong NLS settings But Correct Output ? change for character input? SQLPLUS

620942May 27 2008 — edited Jun 2 2008
hi everybody, my question is abit long,i spend quite some time typing it so please bear with me for awhile and i hope you gurus would read and help me if you can.

I have read from nls_lang faq that
NLS_LANG environment parameter is the simplest way to specify locale >>behavior for Oracle software. It also indicates the client's character set, which >>corresponds to the character set for data to be entered or displayed by a client >>program.
Now, I need to input thai using my SQL*PLUS as well, but besides the output of data, i want to read the remaining as ENGLISH. And out of curiousity to test my understanding of whether NLS_LANG needs to be set for displaying thai fonts during insertion of values ( it use to show me wierd output, when i type in THAI as value for insertion in SQLPLUS)

i have done the following.

I went to Control Panel / Regional and Language Setting / Under Advance Tab / Language for Non-unicode software - I set to Thai (Previously English-United States) and also in the Code Page Conversion table , i have ticked everything that has a mapping in THAI. Then i done a restart of my PC.

I am a window XP user. I am running on Oracle 10g and i am using window SQL*PLUS.

My current settings are
For my OS Code Page
In registry - hlm\system\currentcontrolset\control\nls - parameter ACP - 874 (Thai)

For my NLS_LANG
In registry under my Oracle Key, i set it to AMERICAN_AMERICA.WE8MSWIN1252
(Instead of AMERICAN_AMERICA.TH8TISASCII)

For my DB(non-unicode) nls parameters, my current setting are
Db Character Set - WE8MSWIN1252
National Character Set - AL16UTF16
------------------------------------------------------------------------------------------------------------------------

Test 1) NLS_LANG need to be set for input of foreign language
i login to the SCOTT/TIGER schema and simply done a insertion using thai font, it works.

- So i conclude that , for just INPUTTING of foreign language , changing the OS code page is enough.

However NLS_LANG is needed so that correct conversion can take place between the OS application layer and the DB layer

Q1) am i right to say so ? If i am right, here comes the main tricky problem
------------------------------------------------------------------------------------------------------------------------
From what i knew ( i am not sure if i am right, pls guide me if i aint), NLS_LANG characterset is set to what your OS code page is, so that Oracle can do the conversion of character set encoding if your character set is different from the DB.
And so if my OS code page is difference from my NLS_LANG, i might get a different conversion back when retreving and rubbish data will results.

Since i have a non-unicode DB, i will use a NVARCHAR2 column to do the testing.
Using my current setting
Os Code page - 874 Thai
NLS_LANG - AMERICAN_AMERICA.WE8MSWIN1252
DB NVARCHAR2 column - AL16UTF16

Step 1)
I create a table test with a nvarchar column of size 50 byte.

Step 2)
I insert a thai word into it.

Step 3)
I done a query, and the query shows me in thai perfectly.

Q2) why am i able to read the thai value inserted correctly, since my NLS_LANG is WE8MSWIN1252 characterset but my OS code page is 874 Thai. The conversion is done from UNICODE to WE8MSWIN1252. why am i able to read thai from WE8MSWIN1252 character set ?

------------------------------------------------------------------------------------------------------------------------
What nexts puzzled me even more.......... ( Now i try to set my NLS_LANG to be the same character set with my OS (874 thai), stated in GUIDE also)

NLS_LANG - AMERICAN_AMERICA.TH8TISASCII ( change to thai )
I drop the table and reboot my OS.

Now i do step 1 to 3.
But i am not able to see THAI anymore, INSTEAD i am seeing ??. Why so ? I am using the same character set from my OS in NLS_LANG and i cant see the value inserted when AL16UTF16 is converted to TH8TISASCII. But in WE8MSWIN1252 , it works when it doesnt matches my OS CODE page.

Is there some conversion lost between TH8TISASCII and AL16UTF16 and why WE8MSWIN1252 would work, what are the relationship between the 3 ?


Thanks for reading up till this far, and your kind advice would be really very much appreciated.

-Noob
----------------------------------------------------------------------------------------------------------------------
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 30 2008
Added on May 27 2008
5 comments
4,947 views