oracle - Rollback the changes made by a procedure -
i have procedure myprocedure
create or replace procedure myprocedure begin --some checking goes here insert table1 values.. --some checking goes here delete table2; end myprocedure;
i have called procedure , executed without errors. can rollback
changes made procedure?
i guess you're looking savepoint. savepoints save transactions states , rollback specified point in time.
create or replace procedure myprocedure begin --some checking goes here insert table1 values.. savepoint my_savepoint; --some checking goes here delete table2; exception when dup_val_on_index rollback do_insert; dbms_output.put_line('insert has been rolled back'); end myprocedure;
check oracle documentation:
Comments
Post a Comment