choosing NLS_LANG for Oracle - oracle

According to the site,
http://www.dba-oracle.com/t_nls_lang.htm
Problem might occur even if both the database and the client use the same characterset(AL32UTF8). I couldn't understand how this can be possible.
Quoting from the site:
For example, suppose that the database character set is AL32UTF8, the
client is an English Windows operating system, and the NLS_LANG
setting on the client is AL32UTF8. Data coming into the database is
encoded in WE8MSWIN1252 and is not converted to AL32UTF8 data
because the NLS_LANG setting on the client matches the database
character set. Thus Oracle assumes that no conversion is necessary,
and invalid data is entered into the database.
How can the data be coming as WE8MSIN1252 into the database when the encoding in the client is AL32UTF8?.

Because OS itself using other character set (WE8MSIN1252 in this case). But since NLS_LANG (on client) is set to AL32UTF8, Oracle does not know about this. Oracle always uses value in NLS_LANG and ignores system settings, while (almost) all other software uses OS settings.
So, to fix this problem, local (client) NLS_LANG must be the same as OS character set. Or (other option) software running on client must reencode characters by itself.

Related

Does Autonomous Database offer same NLS support as on-premises database?

Most of our databases are using French character set, date, currency, sort, etc. Some databases can also do OS calls and the OS can be in French as well. Can we state that all NLS Support features will behave the same in Autonomous DB as on-premises DB?
The NLS params they can change in ADB-S are documented here:
https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/appendix-restrictions-database-initialization-parameters.html#GUID-7CF648C1-0822-4602-8ED1-6F5719D6779E.
They cannot change the change the character set in ADB-S as of today, it uses UTF8. That's the unicode characterset that "catches it all" and can be used for your French databases are covered.
They cannot change the OS language, ADB-S is a managed service and will never allow OS changes.

how to make sql developer display diacritic character correctly instead of displaying squares?

I am unable to see the diacritic characters (with accents) in my oracle SQL Developer. I have tried with all the Font option. Is any way I can add the "Arial Unicode MS" font in my oracle SQLDeveloper and see the character instead of the square box.
Since SQL Developer is based on pure Java and JDBC there is the a possibility that the data itself were stored wrong - this could happen when you used not proper client NLS_LANG value and/or wrong codepage (Windows) or LANG (Linux / Unix). Since Data allready in DB and fetch with SQL Developer returns crap, this is by 95% a NLS issue.
Please let us know Database Charachterset and NLS_LANG and Codepage (chcp) settings of client. You can perform
Select <Colname>, dump(<colname>) "Dump" from <table>;
To return a column and dump in Sqlplus.
Provide
NLS_LANG of client
Client codepage (Windows) or LANG (Linux)
Database Charachterset
the value from select,
the expected value and
value from SQL Developer performing the same select as shown above
and we will see 😉

Issue in storing value in Nvarchar column in Oracle

I have a table with NVarchar column in oracle.When I inserted below value it converted into some other characters.
Insert INTO tbltest (CONTENT) Values(N'✓ à la mode δ')
Select * From tbltest
CONTENT
--------------------
¿ à la mode d
So what datatype should i take to save this type of data.Please suggest.
For SQL Developer I don't know exact solution but check settings in Tools -> Preferences -> Environment -> Encoding.
Select an encoding which supports your characters, e.g. UTF-8
Regarding your C# Code:
Microsoft .NET Framework Data Provider for Oracle is deprecated for many years, you should not use it in new projects. I think development stopped 20 years ago, thus it does not support Unicode characters - you cannot use it.
Use a modern provider, e.g. "Oracle Data Provider for .NET (ODP.NET)", you can download it from here: Oracle Data Access Components (ODAC) for Windows Downloads
In case of "Oracle Data Provider for .NET" you have to set NLS_LANG to an encoding which support these characters, e.g. .AL32UTF8. You can set NLS_LANG either as Environment variable or in Registry at HKLM\SOFTWARE\Wow6432Node\ORACLE\KEY_%ORACLE_HOME_NAME%\NLS_LANG (for 32 bit), resp. HKLM\SOFTWARE\ORACLE\KEY_%ORACLE_HOME_NAME%\NLS_LANG (for 64 bit).
Other providers (e.g. ODP.NET Managed Driver or Oracle OraOLEDB) are not NLS_LANG sensitive.
See more information here: OdbcConnection returning Chinese Characters as "?"
This is due to your NLS_CHARACTERSET, NLS_NCHAR_CHARACTERSET database settings and NLS_LANG settings ar your client end where you are seeing.
As your value has special character specific to your language, you need to set with that. Like below

Thai language Configuration in Oracle

I have an issue regarding configuring Thai language in oracle (PL/SQL Developer). I have configured Thai language 'AMERICAN_AMERICA.TH8TISASCII' in regedit. Also I configured Environment variables in my computer. But still when I connect PL/SQL developer and retrieve data, columns that should show Thai descriptions are showing garbage data. Please help me.
Example of garbage data is '¿¿¿¿¿¿¿¿'
Oracle Configurations is as below :
regedit->computer->HKEY_LOCAL_MACHINE->SOFTWARE->ORACLE->KEY_OraDB11g_home1
Windown Configuration is as below:
Mycomputer->Advanced system setting->Advanced System
Settings->Environment Variables -> (here i added variable)
the same configuration is done by my peers and they got the configuration but i am not able to do this
I have configured Thai language 'AMERICAN_AMERICA.TH8TISASCII' in regedit.
It means you have configured your NLS_LANGUAGE as AMERICAN and NLS_TERRITORY as AMERICA. Which is wrong.
You should select the following:
NLS_LANGAUGE=THAI
NLS_TERRITORY=THAILAND
You need to do this at:
Database level - init.ora file
Environment level - NLS LANG settings
I think your characterset is fine.
UPDATE OP got the issue with PL/SQL Developer tool.
You can enter "alter session" commands in the AfterConnect.sql file in the PL/SQL Developer installation directory. For example:
alter session set nls_date_format='dd-mm-yyyy';
alter session set nls_territory='THAILAND';
alter session set nls_language='THAI';
source
I assume your selected font in PL/SQL Developer does not support Thai characters. Try this command to check:
SELECT UNISTR('Kho Khuat: \0E03') FROM DUAL;
Do you get proper output like this?
Kho Khuat: ฃ
If not, you should select a font which support Thai characters.
You can use this page FileFormat.info to check which font supports your character.
Value for NLS_LANG should match your local environment settings, not the setting from Database. By this all characters are properly translated in SQL communication.
Check you local environment with this command:
c:\>reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage /v ACP
In my case it is
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage
ACP REG_SZ 1252
So, my NLS_LANG should be set to .WE8MSWIN1252 or something similar.
However, this is only valid if your application (SQL Developer in your case) uses the default encoding settings from Windows. In some applications you can change that - typically you can switch between local codepage and Unicode (UTF-8). In this case you must modify NLS_LANG accordingly.

how to use different oracle character sets in one application

i'm developing a 32bit Client-Application with Delphi. From this application I need to connect to databases on two different servers. First databse character set ist WE8MSWIN1252, the other server decodes with WE8PC850. Setting the client NLS_LANG parameter to the correct value solves correct sql-query results.
Unfortunately this (the client character-set) seems only to be recognized on applications startup (first connect to oracle). I need to change the client-characterset at runtime. Oracle client seems to store the character set an application used to connect!
beside: I#m using udl-files to setup the connections (Microsoft OLE DB - driver)
what can I do?
You could use ALTER SESSION calls to change the settings at the session level after connecting to the database.
I need to change the
client-characterset at runtime.
Why ? I would have thought what you want at the client end is a character set that is acceptable to the operating environment and end-user.
Pick out a character set such as UTF-8 and let Oracle handle the conversion between the client character set and the two database character sets.

Resources