---隨便帖一點
declare
v_odrm odrm%rowtype;
type t_index_odrm is table of odrm%rowtype index by binary_integer;
v_index_odrm t_index_odrm;
procedure pro_1(i_odrm in odrm%rowtype) as--記錄傳遞
begin
dbms_output.put_line(i_odrm.fact_no);
dbms_output.put_line(i_odrm.fact_odr_no);
end;
function fun_1(i_index_odrm in t_index_odrm)--數組傳遞
return booleanis
i int;
begin
i := i_index_odrm.first;
while i is not nullloop
v_odrm.fact_odr_no := i_index_odrm(i).fact_odr_no;
v_odrm.fact_no := i_index_odrm(i).fact_no;
pro_1(v_odrm);
i := i_index_odrm.next(i);
end loop;
return true;
end;
begin
select * bulk collect into v_index_odrm from odrm;
if fun_1(v_index_odrm) then
dbms_output.put_line('OK!');
end if;
end;