Oracle中 instr 函数
Oracle中 instr 函数instr(string1,string2[,start_position[,nth_appearence]]) string1:要在此字符串中查找。 string2:要在string1中查找的字符串。 start_position:从string1开始查找的位置。可选,默认为1,正数时,从左到右检索,负数时,从右到左检索。 nth_appearence:查找第几次出现string2。可选,默认为1,不能为负。 注:如果没有查找到,返回0。 例如: selectinstr('abcd','a') from dual; --返回1 例如: ① select code,name,dept,occupationfrom staffwhereinstr(code,'001') > 0; 等同于 select code,occupationfrom staffwhere codelike '%001%' ; ② select ccn,mas_loc from mas_loc whereinstr('FH,FHH,FHM',ccn)>0; 等同于 select ccn,mas_loc from mas_loc where ccn in ('FH','FHH','FHM'); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |