RE: NLS question

  • From: "martin.busik@xxxxxxxx" <martin.busik@xxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Wed, 16 Mar 2011 09:25:33 +0100 (CET)

Hi Mike,
 
> I am still having a bit of a problem understanding how the
> NLS_NCHAR_CHARACTERSET is used though.
 
NCHAR-feature is a feature causing many many headaches around the world...
> SQL> create table my_table(col1 nchar(10));
> SQL> insert into my_table values(N'ó');
> SQL> select COL1,dump(col1, 16) col_dump from  my_table;
> COL1
> ----------
> COL_DUMP
> -----------------------------------------------
> o
> Typ=96 Len=20: 0,6f,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20,0,20
 
It seems that you've entered the sql command directly to a terminal. This is
quite fine, but -
the terminal might use a different encoding than sqlplus...
 
 
Even on the windows plattform the
command box (cmd.exe) uses (by default) an another character set (WE8PC850) than
the GUI components.
I.e. in order to get the characters right, you have to set NLS_LANG=.we8pc850
when entering commands
directly. When your comands are stored in a file, you have to set NLS_LANG= to
the encoding of the FILE!
 
So, back to your example.
Try this:
 
1. Store your sql command in a file using an encoding you are sure of.
2. set NLS_LANG to that encoding
3. sqlplus / <file.sql
4. check the output
 
I suppose, in  that situation it will behave as expected (i.e "o accent" does
not get replaced by "o").
 
Cheers,
Martin
 

Other related posts: