Nested savepoints for batch job
SQL
Medium
2 views
Problem Description
During a batch insert, you want to rollback only the last 100 rows if something goes wrong. Show the savepoint pattern.
Sample Test Case
Input:
Any staging inserts
Output:
Controlled rollback
Constraints
Pattern example
Official Solution
BEGIN; SAVEPOINT batch_100; INSERT INTO Products(name, price) VALUES ('X', 10); ROLLBACK TO batch_100; COMMIT;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!