1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| create or replace function f_titi ( v_p1 in varchar2, v_p2 in varchar2, v_p3 in varchar2, v_p4 in number, v_p5 in number) return t_titi is
ret t_titi;
begin
for c in (select * from (select I1, I2, I3, I4, I5, P1, P2
from ( select 1 ord, T.* from titi T where nvl(I1,v_p1)=v_p1 AND nvl(I2,v_p2)=v_p2 AND nvl(I3,v_p3)=v_p3 AND nvl(I4,v_p4)=v_p4 AND nvl(I5,v_p5)=v_p5 union all
select 2, T.* from titi T where nvl(I1,v_p1)=v_p1 AND nvl(I2,v_p2)=v_p2 AND nvl(I3,v_p3)=v_p3 AND nvl(I4,v_p4)=v_p4 union all
select 3, T.* from titi T where nvl(I1,v_p1)=v_p1 AND nvl(I2,v_p2)=v_p2 AND nvl(I3,v_p3)=v_p3 union all
select 4, T.* from titi T where nvl(I1,v_p1)=v_p1 AND nvl(I2,v_p2)=v_p2 union all
select 5, T.* from titi T where nvl(I1,v_p1)=v_p1 union all
select 6, T.* from titi T
) order by ord
) where rownum=1)
loop
select cast( multiset( select c.I1, c.I2, c.I3, c.I4, c.i5, c.P1, c.P2 from dual) as t_titi ) into ret from dual;
end loop;
return ret;
end;
/ |