create table test_ins (table_name varchar2(3000));
truncate table test_ins;
select * from test_ins;
declare
type nes_tab is table of user_tables.table_name%TYPE index by pls_integer;
nest_obj nes_tab;
cursor c1 is
select table_name from user_tables ;
begin
open c1;
loop
fetch c1 bulk collect into nest_obj limit 5;
forall i in 1..nest_obj.count save exceptions
insert into test_ins values(nest_obj(i));
commit;
exit when c1%notfound;
end loop;
close c1;
exception when others then
dbms_output.put_line('Exception occurred :'||SQLERRM || SQLCODE);
end;
/
truncate table test_ins;
select * from test_ins;
declare
type nes_tab is table of user_tables.table_name%TYPE index by pls_integer;
nest_obj nes_tab;
cursor c1 is
select table_name from user_tables ;
begin
open c1;
loop
fetch c1 bulk collect into nest_obj limit 5;
forall i in 1..nest_obj.count save exceptions
insert into test_ins values(nest_obj(i));
commit;
exit when c1%notfound;
end loop;
close c1;
exception when others then
dbms_output.put_line('Exception occurred :'||SQLERRM || SQLCODE);
end;
/
No comments:
Post a Comment