create or replace function checkContainStr /****************************** description:比对两个传入的字符串是否含有相同的字符串,并返回相同的数量 author:lwh date:2011-12-18 ver:1.0 ********************************/ (strSource in varchar2,strTarget in varchar2,splitMark in varchar2) return pls_integer as j INT := 0; i INT := 1; len INT := 0; len1 INT := 0; str VARCHAR2 (4000); counts pls_integer:=0; begin len := LENGTH (strSource); len1 := LENGTH (splitMark); WHILE j < len LOOP j := INSTR (strSource, splitMark, i); IF j = 0 THEN j := len; str := SUBSTR (strSource, i); if instr(strTarget,str)>0 then counts:=counts+1; end if; IF i >= len THEN EXIT; END IF; ELSE str := SUBSTR (strSource, i, j - i); i := j + len1; if instr(strTarget,str)>0 then counts:=counts+1; end if; END IF; END LOOP; RETURN counts; end;
深入oracle,去透析oracle每个角落。
DBA、SQL开发技术人的集市,QQ高级群群号35448096