Oracle 9i引入的一个字符函数
功能:返回字符对应的ASCII码,对于非ASCII码转化为Unicode并前置符号'/'
下面做个例子来看看
SQL> create table test(tt varchar2(10));
Table created.
SQL> insert into test values('haha');
1 row created.
SQL> insert into test values('哈哈');
1 row created.
SQL> insert into test values('@#$%');
1 row created.
SQL> insert into test values('po/efe');
1 row created.
SQL> commit;
SQL> select tt,asciistr(tt) from test;
TT ASCIISTR(TT)
---------- --------------------------------------------------
haha haha
哈哈 /FFFD/FFFD/FFFD/FFFD
@#$% @#$%
po/efe po/005Cefe
SQL> select * from test
2 where asciistr(tt) like '%/%' and instr(tt,'/') <= 0;
TT
----------
哈哈
后面那个instr(tt,'/') <= 0条件是为了排除本身内容中就包含'/'的记录,把这个条件取掉试试
SQL> select * from test
2 where asciistr(tt) like '%/%';
TT
----------
哈哈
po/efe
原文地址:http://blog.youkuaiyun.com/wh62592855/archive/2009/12/08/4967682.aspx