ㅎㅎ
마침 아침에 제가 테스트 한것 하고 똑같네욤
create or replace package zz_phh_test
is
type type_item is record
(
item_id number
, item_name varchar2(60)
) ;
type set_item is table of type_item INDEX BY PLS_INTEGER;
type type_item_set is record
(
item_id number
, item_name varchar2(60)
) ;
type set_item_set is table of type_item_set INDEX BY PLS_INTEGER;
procedure main;
end zz_phh_test ;
create or replace package body zz_phh_test
is
procedure main
is
ret_item set_item ;
ret_item_set set_item_set ;
cursor cur_data is
select item_id, item_name
from idb_item_master
where product_type = 'SET'
;
begin
open cur_data ;
fetch cur_data bulk collect into ret_item ;
close cur_data ;
for x in ret_item.first..ret_item.last loop
ret_item_set(x).item_id := ret_item(x).item_id ;
ret_item_set(x).item_name := ret_item(x).item_name ;
end loop ;
for inx in 1..ret_item_set.count loop
insert into zz_phh values(ret_item_set(inx).item_id, ret_item_set(inx).item_Name);
end loop ;
commit;
exception
when others then
rollback;
raise_application_error( -20200, sqlerrm ) ;
end main ;
end zz_phh_test ;