Forum Stats

  • 3,734,446 Users
  • 2,246,973 Discussions
  • 7,857,293 Comments

Discussions

Selective commit

user-dym_on_3270226
user-dym_on_3270226 Member Posts: 2 Blue Ribbon
edited May 14, 2021 12:26PM in Database Ideas - Ideas

Well, I need an ability to commit operation in some table. Sample code:

insert into T1 ....

insert into T2...

insert into T3...

commit (T3);

rollback;


In this case ROLLBACK executes only for T1 and T2.

For what it needs?

Let you have got a long transaction where qeue many statements have to execute, and each statement has some info which you write into special table. If exception occures I want to save all info about statements. Or for the test runs.

user-dym_on_3270226User_69K8X
2 votes

Active · Last Updated

Comments

  • Rostislav Kushnirenko
    Rostislav Kushnirenko Member Posts: 3 Blue Ribbon

    Is SAVEPOINT functionality something what you are looking for? Also maybe check documentation for DBMS_TRANSACTION package - some its procedures maybe contains functionality you need.

    ChristyxoWilliam Robertson
  • user-dym_on_3270226
    user-dym_on_3270226 Member Posts: 2 Blue Ribbon

    No, SAVEPOINT doesn't fit.

    In my example:

    insert into T1 ....

    insert into T2...

    insert into T3...

    commit (T3);

    rollback;

    T1 and T2 must be rolled back, but T3 must be committed. How to this with SAVEPOINT? Statements order is important.

    Extended example:

    insert into T1 ....

    insert into T3...

    insert into T2...

    update T3...

    update T1 ...

    insert into T3...

    commit (T3);

    rollback;

    ROLLBACK must executes only for T1 and T2.

Sign In or Register to comment.