Oracle 判断输入是否是汉字

来源:互联网 发布:ubuntu 16.04更新失败 编辑:程序博客网 时间:2024/06/09 21:40

判断字段中是否包含中文的方法SQL> 查询所有loginname是汉字的记录:

select * from studentbaseinfo where asciistr(loginname) like '%/%' ;

查询所有loginname不是汉字的记录:

select * from studentbaseinfo where asciistr(loginname) not like '%/%';

查询输入数据是否包含汉字,是就返回1,不是就返回0;使用 not like正好相反。

select count(1) from dual where asciistr('linyb') like '%/%';  

select count(1) from dual where asciistr('是汉字') like '%/%' ;

select count(1) from dual where asciistr('inyb) not like '%/%'  

 

其实asciistr只是判断是否是多字节,并不能确定一定是汉字,对其他多字节表示的语言同样适用。

原创粉丝点击