Oracle中 instr 函数
2017-08-16 18:34
218 查看
instr(string1,string2[,start_position[,nth_appearence]])
string1:要在此字符串中查找。
string2:要在string1中查找的字符串。
start_position:从string1开始查找的位置。可选,默认为1,正数时,从左到右检索,负数时,从右到左检索。
nth_appearence:查找第几次出现string2。可选,默认为1,不能为负。
注:如果没有查找到,返回0。
例如:
select instr('abcd','a') from dual; --返回1
select instr('abcd','c') from dual; --返回3
select instr('abcd','e') from dual; --返回0
该函数可以用于模糊查询以及判断包含关系:
例如:
① select code, name, dept, occupation from staff where instr(code, '001') > 0;
等同于
select code, name, dept, occupation from staff where code like '%001%' ;
② select ccn,mas_loc from mas_loc where instr('FH,FHH,FHM',ccn)>0;
等同于
select ccn,mas_loc from mas_loc where ccn in ('FH','FHH','FHM');
文章链接:http://www.cnblogs.com/crazyjava/archive/2012/10/31/2748202.html
string1:要在此字符串中查找。
string2:要在string1中查找的字符串。
start_position:从string1开始查找的位置。可选,默认为1,正数时,从左到右检索,负数时,从右到左检索。
nth_appearence:查找第几次出现string2。可选,默认为1,不能为负。
注:如果没有查找到,返回0。
例如:
select instr('abcd','a') from dual; --返回1
select instr('abcd','c') from dual; --返回3
select instr('abcd','e') from dual; --返回0
该函数可以用于模糊查询以及判断包含关系:
例如:
① select code, name, dept, occupation from staff where instr(code, '001') > 0;
等同于
select code, name, dept, occupation from staff where code like '%001%' ;
② select ccn,mas_loc from mas_loc where instr('FH,FHH,FHM',ccn)>0;
等同于
select ccn,mas_loc from mas_loc where ccn in ('FH','FHH','FHM');
文章链接:http://www.cnblogs.com/crazyjava/archive/2012/10/31/2748202.html
相关文章推荐
- Oracle正则表达式函数:regexp_like、regexp_substr、regexp_instr、regexp_replace
- SQL中Charindex和Oracle中对应的函数Instr
- Oracle中的instr()函数 详解及应用
- oracle常用函数instr()和substr()
- oracle中的正则表达式函数regexp_instr
- Oracle正则表达式函数:regexp_like、regexp_substr、regexp_instr、regexp_replace
- Oracle中的instr()函数详解及应用
- Oracle正则表达式函数:regexp_like、regexp_substr、regexp_instr、regexp_replace
- Oracle正规则函数的用法,regexp_substr,REGEXP_LIKE,REGEXP_INSTR,REGEXP_REPLACE
- Oracle中的instr()函数 详解及应用
- oracle函数:instr
- Oracle 正则表达式函数-REGEXP_INSTR 使用例子
- oracleI基础入门--函数-instr
- oracle的常用函数 instr() 和substr()函数(转)
- oracle 使用instr()函数对in查询出的记录按照in中的数据进行排序
- Oracle中 instr 函数
- Oracle正则表达式函数:regexp_like、regexp_substr、regexp_instr、regexp_replace
- Oracle instr()函数获取数据字段已知字符串的位置
- Oracle中的instr和substr函数
- oracle的常用函数 instr() 和substr()函数