在Oracle中,可以使用instr函数对某个字符串进行判断,判断其是否含有指定的字符。其语法为:
instr(sourceString,destString,start,appearPosition). 其中
1: sourceString代表源字符串;
2: destString代表想聪源字符串中查找的子串;
3: start代表查找的开始位置,该参数可选的,默认为1;
4: appearPosition代表想从源字符中查找出第几次出现的destString,该参数也是可选的,默认为1;
返回值为:查找到的字符串的位置。
说明: 如果start的值为负数,那么代表从右往左进行查找。
例如:
[img]http://dl.iteye.com/upload/attachment/542785/d27fcf60-f3a0-337f-967d-9955f12e83ae.jpg[/img]
instr(sourceString,destString,start,appearPosition). 其中
1: sourceString代表源字符串;
2: destString代表想聪源字符串中查找的子串;
3: start代表查找的开始位置,该参数可选的,默认为1;
4: appearPosition代表想从源字符中查找出第几次出现的destString,该参数也是可选的,默认为1;
返回值为:查找到的字符串的位置。
说明: 如果start的值为负数,那么代表从右往左进行查找。
例如:
select * from dictionary where instr(comments,'index')>0;
[img]http://dl.iteye.com/upload/attachment/542785/d27fcf60-f3a0-337f-967d-9955f12e83ae.jpg[/img]