Last active
September 3, 2015 07:21
-
-
Save Brutt/ca7e0c71141008485cc2 to your computer and use it in GitHub Desktop.
Rollback_in_loop_2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*using savepoint*/ | |
declare | |
i integer; | |
cnt number := 0; | |
begin | |
insert into tbl_1 | |
(id1) | |
values | |
(1); | |
for s in (SELECT t.* FROM all_objects t where rownum < 3) loop | |
cnt := cnt + 1; | |
execute immediate 'savepoint svp'||cnt; | |
begin | |
insert into tbl_2 | |
(id2) | |
values | |
(1); | |
i := 7 / (2-2); | |
exception | |
when others then | |
execute immediate 'rollback to savepoint svp'||cnt; | |
dbms_output.put_line(SQLERRM || ' => ' || cnt); | |
end; | |
end loop; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment