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