DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: transaction inside a transaction

  1. #1
    Join Date
    Jan 2001
    Posts
    44

    Question

    hello,
    i have a problem
    i have a big transaction failling because of a constraint failure
    as my transaction delete a lot of rows i can't tell where is the problem
    i have the possibillity to trace everything on a trace table. But as the transaction failed my trace table is also rollback!!!

    so is there a possibillity to insert a rows on a table with a 'local commit' of that trace and not on the rest of the big transaction

    thanks

    Alain

  2. #2
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    Hello,
    autonomous transaction will help you:
    Code:
    procedure do_report(r in varchar2)
    is
      pragma autonomous_transaction;
    begin
      insert into t_report values(r);
      commit;
    end;
    Procedure above inserts a string into report-table and commits. This commit doesn't have anything to do with a transaction outside.
    HTH,
    Ales

  3. #3
    Join Date
    Jun 2001
    Location
    Helsinki. Finland
    Posts
    3,938

    And remember the following interesting fact. If you have the autonoumous transaction in a trigger, then you still need the commit!

    Oracle Certified Master
    Oracle Certified Professional 6i,8i,9i,10g,11g,12c
    email: ocp_9i@yahoo.com

  4. #4
    Join Date
    Aug 2001
    Location
    Waterloo, On
    Posts
    547
    You can disable constraints before executing the transactions and then enable them using something like

    ALTER TABLE dept ENABLE PRIMARY KEY EXCEPTIONS INTO exceptions;

    You need an exceptions table for showing bad records.
    You can create an exception table by running the script UTLEXCPT.SQL, which creates a table named EXCEPTIONS.

    You can find out the offending rows by

    SELECT * FROM exceptions;

    and then delete/modify them.

    Raminder Singh

    Oracle Certified DBA: Oracle 8i, 9i


    Mail me at raminderahluwalia@rediffmail.com.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width