Re: NLS question

  • From: Martin Berger <martin.a.berger@xxxxxxxxx>
  • To: mschmitt@xxxxxxxxxxxx
  • Date: Sun, 13 Mar 2011 08:03:36 +0100

Michael,

afaik, there is no quick answer to any NLS related question.
As you did not provide all details, let's start with some explanations, so
you can choose which one matches your situation best.
*) every time you are thinking about NLS situations, at least the server
settings (NLS_CHARACTERSET from v$nls_parameters) and the client settings
(env. var NLS_LANG) are important.
*) If the clients and servers charracterset differs, one side must do a
conversion for you. (Oracle prefers the client to do that work, if
possible). At this step  if you try to use a character in the DB which is
not defined there, the client 'tries its best' to map a similar character.
*) If the charactersets are the same, no conversion takes place. The client
will just send the character to the database and this will process it. In
such a case you can even bring an 8-byte character into a 7 byte DB. And as
long as at writing and reading the settings are the same, noone will see the
issue.

you can run a
SELECT col1, dump(col1, 16) col_dump
FROM my_table;

There you will see hat is really stored in the data-block.

In MSWIN1252 'ó' is at position 00F3 *243*.
in Unicode:
 U+00F3 ó Latin Small Letter O with acute
In UTF it's C3-B3.


I hope I did not confuse you too much.

hth
 Martin


On Thu, Mar 10, 2011 at 22:53, Michael Schmitt <mschmitt@xxxxxxxxxxxx>wrote:

> Hi All,
>
>
>
> I had a quick question on the NLS configuration that I was hoping someone
> could help me out with
>
>
>
> Oracle 11.2 database with NLS_CHARACTERSET=US7ASCII and
> NLS_NCHAR_CHARACTERSET=AL16UTF16
>
>
>
> Developer creates a table with nvarchar2(1000) column and tries to insert a
> ó into that column.
>
>
>
> Create table my_table(col1 nvarchar2(1000));
>
> Insert into my_table values ('Acadó');
>
>
>
> SQL> select * from my_table;
>
> COL1
>
>
> --------------------------------------------------------------------------------
>
> Acad?
>
>
>
> I was thinking this might be a session issue, but was not sure what I
> should have their client set NLS_LANG too.  If I set NLS_LANG to
> AMERICAN_AMERICA.WE8MSWIN1252 in the session I get a different result, but
> not exactly the one I am looking for
>
>
>
> SQL> select * from my_table;
>
> COL1
>
>
> --------------------------------------------------------------------------------
>
> Acado
>
>
>
> Any help would be appreciated
>
> Thanks in advance
>
>
>
>
>

Other related posts: