oracle 11g nvarchar2 varchar2 varchar对比

oracle11g sql对比

nvarchar不支持,直接报错

select cast('二一' as nvarchar2(4)) from dual; 
select cast('二一' as varchar2(4)) from dual; 
select cast('二一' as varchar2(6)) from dual; 
select cast('二一' as varchar(4)) from dual;

select cast('000' as nvarchar2(3)) from dual; 
select cast('000' as varchar2(3)) from dual; 
select cast('000' as varchar(3)) from dual; 

--数据库编码
select * from nls_database_parameters where parameter ='NLS_CHARACTERSET';
--客户端编码
select * from nls_instance_parameters where parameter='NLS_LANGUAGE';

输出

二一
二
二一
二
00
000
000

1   NLS_CHARACTERSET    AL32UTF8
1   NLS_LANGUAGE    AMERICAN

varchar最大支持2000字节
nvarchar2/varchar2最大支持4000字节
varchar2中文3字节
nvarchar2中文2字节

nvarchar2非汉字显示不全

注:nvarchar2非汉字显示不全还是跟客户端有关,plsql显示不全,但是换成toad就可以正常显示了,plsql还是不够强大

猜您喜欢
评论已关闭。