Error handling for nested transactions and transaction savepoint

Source: Internet
Author: User
Tags savepoint try catch

For nested transactions.
1. External transactions, internal transactions, inside and outside have try Catch
Internal error: If an internal transaction goes wrong, both internal and external things are rolled back, the operation before the external rollback does not exist, but the subsequent operation continues.
External error: If an external thing goes wrong, both internal and external things are rolled back, the operation before the external rollback does not exist, but the subsequent operation continues.
Note: If an internal transaction does not have a transaction name, the internal error will roll back all transactions in the session and report an exception.

2. External transaction, internal transaction, internal no try Catch
Internal error: If an internal transaction goes wrong, both internal and external things are rolled back, the operation before the external rollback does not exist, but the subsequent operation continues.
External error: If an internal transaction goes wrong, both internal and external things are rolled back, the operation before the external rollback does not exist, but the subsequent operation continues.

3. External transactions, internal transactions, but there are try Catch.
Internal error: External things normally submitted, external things will not enter the rollback, internal error after the record will be normal execution. In an internal operation, the try part is normal before the error occurs, the try part does not execute after the operation, and then enters the catch block to perform the operation.
External error: Both internal and external things are rolled back, the operation before the external rollback does not exist, but subsequent operations continue.

4. External transaction, no internal transaction, but no try Catch.
Internal error: If an internal transaction goes wrong, both internal and external things are rolled back, the operation before the external rollback does not exist, but the subsequent operation continues.
External error: If an internal transaction goes wrong, both internal and external things are rolled back, the operation before the external rollback does not exist, but the subsequent operation continues.

5. External transaction, internal transaction, but have try Catch.
Internal error: The external operation was performed normally, the internal rollback was rolled back before the operation, and then the operations were performed normally.
External error: The operation before the error operation is not rolled back, the operation after the error does not execute, jumps into the catch block, and the internal transaction is not rolled back.

6. External transaction, internal transaction, but no try Catch.
Internal error: External operation is performed normally, and all rollback before internal rollback operation. Because there is no catch block, all external operations are performed.
External error: Internal transaction is committed properly, external only if the record fails, other operations are performed normally, but there are serious errors reported.


For a transaction save point
Transaction savepoint only save and rollback operations, when external calls internal savepoint, internal problems do not affect external transactions, external operations are performed normally. When there is a problem with the external operation, all internal operations are rolled back.

such as: external transactions, internal storage point, both inside and outside have try Catch
Internal error: The external operation is normal, the catch is not entered, the internal transaction is rolled back to the savepoint, and then the execution continues.
External error: If an exception occurs before the save point, all external and internal operations are rolled back. If an exception occurs before the save point, the external rollback cannot find the corresponding transaction point because the SavePoint has committed the transaction.

Error handling for nested transactions and transaction savepoint

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.