oracle的前端transaction能影響到StoredProcedure內的交易嗎?

振賢 王 0 Reputation points
2023-09-01T11:58:38.85+00:00

DEAR ALL

如果前端用c#寫一個oracle的transaction

在transaction裏有異動資料的指令

也有執行procedure,而procedure裏也有異動資料並commit

最後如果前端下roolback,那procedure裏異動的資料會不會也rollback?

謝謝!!

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,127 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vahid Ghafarpour 21,325 Reputation points
    2023-09-29T16:40:21.4566667+00:00

    I think in your scenario, the data changes made by the stored procedure will not be rolled back. Oracle creates a subtransaction by default within the stored procedure, independent of the outer transaction. Therefore, a ROLLBACK operation in the outermost transaction does not affect the COMMIT that occurred within the subtransaction of the stored procedure.

    Using nested transactions can guarantee the rollback to your checkpoints.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.