0

How can I exclude a statement in a transaction rollback?

Begin
Insert into table a
...
...
call proc_1()
...
...
Rollback

How can I rollback all the commands except/prevent proc_1() from rolling back?

1
  • Isn't it as simple as movimg the proc call to the end of the statement?
    – M.Ali
    Dec 11, 2016 at 16:45

1 Answer 1

1

You can make the procedure have its on transaction - called an autonomous transaction, but be careful with this one, you can easily get yourself into deadlocks if you use it carelessly without knowing your transactions.

create or replace procedure p1 (...) as
  pragma autonomous transaction
begin
  ...
end;

Usually this is used for logging purposes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.