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

Thread: How to commit a inner transaction but not effect the parent transaction ?

  1. #1
    Join Date
    Aug 2000
    Location
    Shanghai
    Posts
    433

    How to commit a inner transaction but not effect the parent transaction ?

    1. transaction start(session start)
    2. do something
    3. start inner transaction
    3.1 do something and commit (but don't commit the things did in 2)
    4. rollback (rollback 2 )

    how to realize it , at time of 3 , is it possible to start another session in the procedure ?
    1. www.dbasupport.com
    2. www.dbforums.com
    3. www.itpub.net
    4. www.csdn.net
    5. www.umlchina.com
    6. www.tek-tips.com
    7. www.cnforyou.com
    8. fm365.federal.com.cn
    9. www.programmersheaven.com
    10.http://msdn.microsoft.com/library/default.asp
    ligang1000@hotmail.com

  2. #2
    Join Date
    Jan 2003
    Location
    Denver
    Posts
    152
    You want to use an 'autonomous transaction in PL/SQL' it allows for what you describe.


    http://www.dbasupport.com/oracle/ora...oustrans.shtml

  3. #3
    Join Date
    Aug 2000
    Location
    Shanghai
    Posts
    433
    exactly
    1. www.dbasupport.com
    2. www.dbforums.com
    3. www.itpub.net
    4. www.csdn.net
    5. www.umlchina.com
    6. www.tek-tips.com
    7. www.cnforyou.com
    8. fm365.federal.com.cn
    9. www.programmersheaven.com
    10.http://msdn.microsoft.com/library/default.asp
    ligang1000@hotmail.com

  4. #4
    Join Date
    Jan 2002
    Location
    Up s**t creek
    Posts
    1,525
    Jim
    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

  5. #5
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    Here is an example:
    09:29:47 H8DEVW3>create table t1 (id number) ;

    Table created.

    Elapsed: 00:00:00.30
    09:29:56 H8DEVW3>insert into t1 values (10) ;

    1 row created.

    Elapsed: 00:00:00.80
    09:30:14 H8DEVW3>declare
    09:30:22 2 pragma autonomous_transaction ;
    09:30:37 3 begin
    09:30:39 4 insert into t1 values (20) ;
    09:30:54 5 commit;
    09:30:57 6 end;
    09:30:59 7 /

    PL/SQL procedure successfully completed.

    Elapsed: 00:00:00.90
    09:31:00 H8DEVW3>rollback ;

    Rollback complete.

    Elapsed: 00:00:00.40
    09:31:17 H8DEVW3>select * from t1 ;

    ID
    ----------
    20

    Elapsed: 00:00:00.60
    09:31:22 H8DEVW3>

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