这个数据库字符集是WE8ISO8859P1
------------------Beginning of TEST-----------------
EG:
On
xxx-xxx$> setenv NLS_LANG AMERICAN_AMERICA.UTF8
SQL> create table testbyhao2 (name varchar2(100));
Table created.
SQL> insert into testbyhao2 values ('浩');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from testbyhao2;
NAME
--------------------------------------------------------------------------------
?
SQL> select name,dump(name) from testbyhao2;
NAME
--------------------------------------------------------------------------------
DUMP(NAME)
--------------------------------------------------------------------------------
?
Typ=1 Len=1: 191
SQL> insert into testbyhao2 values ('朱');
1 row created.
SQL> commit;
Commit complete.
SQL> select name,dump(name) from testbyhao2;
NAME
--------------------------------------------------------------------------------
DUMP(NAME)
-------------------------------------------------------------------------------
?
Typ=1 Len=1: 191
?
Typ=1 Len=1: 191
We can see that under NLS_LANG=AMERICAN_AMERICA.UTF8, when we insert 2 different Chinese words,
Actually in Oracle, they are both messy codes(“191”).
That is to say, we lost them!
And the workaround should be set the NLS_LANG to the same with database(AMERICAN_AMERICA.WE8ISO8859P1).
EG:
xxx-xxx$> env|grep -i nls
NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
SQL> create table testbyhao(name varchar2(100)) tablespace cr_data;
Table created.
SQL> insert into testbyhao values('浩');
1 row created.
SQL> commit;
Commit complete.
SQL> select name,dump(name) from testbyhao;
NAME
--------------------------------------------------------------------------------
DUMP(NAME)
--------------------------------------------------------------------------------
浩
Typ=1 Len=3: 230,181,169
SQL> insert into testbyhao values('朱');
1 row created.
SQL> commit;
Commit complete.
SQL> select name,dump(name) from testbyhao;
NAME
--------------------------------------------------------------------------------
DUMP(NAME)
--------------------------------------------------------------------------------
浩
Typ=1 Len=3: 230,181,169
朱
Typ=1 Len=3: 230,156,177
We can see that when under the same character set with database,
The 2 Chinese words are displayed correctly and with 2 different codes.
------------------End of TEST-----------------
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13165828/viewspace-607511/ ,如需转载,请注明出处,否则将追究法律责任。