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:

example 6-38, "using savepoint rollback"

example 6-39, "reusing savepoint rollback"


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -