create or replace procedure sp_insert_data01
as
j number;
k number;
excp exception;
begin
j:= 10;
k:= 20;
if j <= k then
raise excp;
end if;
for i in 1..1000000 loop
insert into tb_hxl_test
values(i,to_char(i)||chr(i));
end loop;
exception
when excp then
begin
dbms_output.put_line('Error code: ' || sqlcode);
dbms_output.put_line('Error description: ' || sqlerrm);
rollback;
end;
insert into tb_hxl_log values('aa','bb'); -- 测试
commit;
end sp_insert_data01;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/77311/viewspace-1025295/ ,如需转载,请注明出处,否则将追究法律责任。