标签:pl/sql
procedure charintersect(i_str1 in varchar2,
i_str2 in varchar2,
o_str out varchar2) is
v_len_str2 number;
v_str2_single varchar2(1);
begin
v_len_str2 := length(i_str2);
for i in 1 .. v_len_str2
loop
v_str2_single := substr(i_str2, i, 1);
if instr(i_str1, v_str2_single) > 0 then
o_str := v_str2_single || o_str;
end if;
end loop;
-- dbms_output.put_line(o_str);
end charintersect;
procedure find_common_char_arr(com_arr t_arrchar,str_result out varchar2) is
v_str varchar2(200);
--type t_table is table of varchar2(200) index by binary_integer;;
begin
if com_arr.count=1 then
v_str:=com_arr(1);
else
for i in 1 .. com_arr.count
loop
if i <= 2 then
charintersect(com_arr(1), com_arr(2), v_str);
else
charintersect(v_str, com_arr(i), v_str);
end if;
end loop;
end if;
-- dbms_output.put_line(v_str);
str_result:=v_str;
end find_common_char_arr;
本文出自 “ORACLE/DB2/MYSQL” 博客,谢绝转载!
标签:pl/sql
原文地址:http://383610.blog.51cto.com/373610/1740349