ITPub博客

首页 > 数据库 > Oracle > 判断字段中是否含有中文字符

判断字段中是否含有中文字符

原创 Oracle 作者:yuchengzhong 时间:2007-04-04 15:03:40 0 删除 编辑

length是字的长度,lengthb是字节的长度,字符集为UTF8

SQL> create table test(a varchar2(20));

Table created

SQL> insert into test values('2');

1 row inserted

SQL> insert into test values('12');

1 row inserted

SQL> insert into test values('四大皆空');

1 row inserted

SQL> commit;

Commit complete

SQL> select * from test;

A
--------------------
2
12
四大皆空

SQL> select a from test where length(a)!=lengthb(a);

A
--------------------
四大皆空

SQL> select a from test where asciistr(a) not like '%%';

A
--------------------
2
12

SQL> select a from test where asciistr(a) like '%%';

A
--------------------
四大皆空

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9460545/viewspace-908702/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论
  • 博文量
    56
  • 访问量
    1675595