Commit and RollBack per transaction

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
  

Poston Wed, 05 Apr 2006 2:40 pm

My question is the following: in the procedure to have an INSERT in the table and call the Procedure B I have an INSERT in table B.
In procedure B give the Commit, but don't want to Commit to save the data of the Insert of the Procedure.

IE how do I give Commit or Rollback for \"session or transaction\".
Lekich
Location: SP

Poston Wed, 05 Apr 2006 3:20 pm

You can do this with AUTONOMOUS TRANSACTION.

Create your procedure B as follows:
Code: Select all
CREATE OR REPLACE PROCEDURE  b  IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
  etc... etc... etc...
Thus, if you give COMMIT her, will not affect the procedure a. even if you give rollback on procedure A, B will continue comitada.

This is very useful when you want to make some kind of LOG, because even if the application raise any ROLLBACK, the LOG will continue recorded correctly.
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered


  • See also
    Replies
    Views
    Last Post


    Return to PL/SQL

    Who is online

    Users browsing this forum: No registered users and 4 guests