Does the OracleTransaction.Rollback() supercedes commit in stored procedure?

520 Views Asked by At

Suppose I have code with multiple stored procedures executing from c# code. Each of the stored procedures have a commit and a rollback in a case of exception. The exceptions are handled within these stored procedures and return a handled error messages.

If i have a an OracleTransaction.BeginTransaction() "running", on the same connection object when executing stored procedures would an OracleTransaction.Rollback() in c# code actually rollback on a data commmited by previously executed stored procedure.

Logic as follows:

  1. Open connection
  2. Begin transaction
  3. Execute one stored procedure (with commit inside)
  4. If all good, execute another stored procedure (with commit). If not, rollback previous stored procedure and stop altogether.
  5. No errors commit transaction. Thank you.
1

There are 1 best solutions below

0
On BEST ANSWER

A COMMIT ends the current transaction, and a new transaction begins with the next executable SQL statement. As a result a subsequent ROLLBACK can only undo changes made since the previous COMMIT, but not before that.