1.创建测试表
SQL> create table test0224
2 (
3 testcol varchar2(50)
4 )
5 ;
Table created
2.插入测试数据
SQL> insert into test0224 values('我爱你');
1 row inserted
SQL> insert into test0224 values('我爱你!');
1 row inserted
SQL> insert into test0224 values('1111');
1 row inserted
SQL> insert into test0224 values('是/否');
1 row inserted
SQL> commit;
Commit complete
3.执行判断
SQL> select testcol,decode(lengthb(testcol),2*length(testcol),'true','false') if_chinese from test0224 ;
TESTCOL IF_CHINESE
-------------------------------------------------- ----------
我爱你 true
我爱你! false
1111 false
是/否 false
判断一个varchar2字段中的数据是否全是汉字的方法
最新推荐文章于 2022-03-25 17:18:07 发布