加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

UTF8字符集,NLS_LANG=AMERICAN_AMERICA.UTF8用两个字节存储汉字

(2008-04-08 12:34:52)
标签:

宋体

字符集

汉字

暗示

存储

分类: ORACLE

 1* select value from v$nls_parameters where PARAMETER = 'NLS_CHARACTERSET'

SQL> /

VALUE

----------------------------------------------------------------

UTF8

SQL> select dump('') from dual;

DUMP('')

--------------------------------------------------

Typ=96 Len=3: 230,177,137

SQL> exit

Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production

With the Partitioning, OLAP and Data Mining options 断开

C:\>set NLS_LANG=AMERICAN_AMERICA.UTF8

C:\>sqlplus "/ as sysdba"

SQL*Plus: Release 10.1.0.2.0 - Production on Tue Apr 8 11:24:39 2008

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select dump('') from dual;

DUMP('')

---------------------

Typ=96 Len=2: 186,186

SQL> select lengthb('') from dual;

LENGTHB('')

-------------

            2

SQL> create table wwm (name char(4));

Table created.

SQL> insert into wwm values ('汉字');

1 row created.

SQL> select * from wwm;

NAME

----

汉字

也就是说,你暗示ORACLE你的环境和ORACLE里的字符集一致。ORACLE就直接保存你输入的东西,而不会把输入转成UTF8

C:\>set NLS_LANG=AMERICAN_AMERICA.zhs16gbk

C:\>sqlplus "/ as sysdba"

SQL*Plus: Release 10.1.0.2.0 - Production on Tue Apr 8 11:42:43 2008

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> select * from wwm;

NAME

--------

??

SQL> select dump(name) from wwm;

DUMP(NAME)

-------------------------------------------------------------------------------

Typ=96 Len=4: 186,186,215,214

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有