The editor holds the night batch: a bonus for Ava, a fee for Sofia, a bonus for Liam. It must run in one transaction.
- Run the batch as it is. Which account's UPDATE fails? Give its id. Then end the aborted transaction with
ROLLBACK;. - Think before you run it: in a transaction, you add 50 to Ava, set a savepoint, and the next UPDATE fails. Then you roll back to the savepoint. What is Ava's balance now?
- Change the batch: set a savepoint before Sofia's fee, roll back to it when the fee fails, then give Liam his bonus and commit. Ava ends with 550, Liam with 230 and Sofia with 50.
A run stops at the first statement that fails. Run the statements after the error in a new run.