TransactionScope and stored procedure?

I have two PL / SQL stored procedures, each of which processes its own transaction (start / commit and rollback in case of an error). From .Net code, I call these two SPs as shown below.

   using (TransactionScope ts = new TransactionScope())
     {
          CallSP1();
          CallSP2().
          ts.SetComplete();
     }

If my call to SP2 fails, will it roll back the changes made by CallSP1 ()? If it is not rolled back, does this mean that it is better to process the transaction from the .Net application, and not inside the stored procedure?

+3
source share
3 answers

If the first stored procedure SP1 issues a commit, any changes that it has already made will be permanent. In this case, if SP2 fails, the changes made by SP1 will not be rolled back.

IMO , .. PL/SQL. , PL/SQL , , .

, ( , ).

+10

SP1 , , SP2. , SP1, - .

+2

, .

, , , . , ( ). , , , , .

+1

Source: https://habr.com/ru/post/1735616/


All Articles