函数调用示例:select CompaireString('12;23;6;9','23;7;9')from dual 结果:2
说明:返回两个字符串中字符交集个数,结果大于零,即可判断两个字符串有交集
--函数如下:
CREATE OR REPLACE
function CompaireString(source varchar2,target varchar2)
return NUMBER
as
v_pric NUMBER;
begin
select count(*) into v_pric from (
select regexp_substr(source, '[^;]+', 1, rownum) nme
from dual
connect by rownum <= length(regexp_replace(source, '[^;]+')) +1
intersect
select regexp_substr(target, '[^;]+', 1,rownum) nme
from dual
connect by rownum <= length(regexp_replace(target, '[^;]+')) +1
);
return v_pric;
end CompaireString;