Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Checks whether a COMMIT can be performed successfully.
PREPARE TO COMMIT
The PREPARE TO COMMIT statement tests whether a COMMIT can be performed successfully. The statement will cause an error if a COMMIT is impossible without violating the integrity of the database.
The PREPARE TO COMMIT statement cannot be used in stored procedures, triggers, events, or batches.
Not in the standard.
The following sequence of statements leads to an error because of foreign key checking on the Employees table.
EXECUTE IMMEDIATE "SET OPTION wait_for_commit = 'On'"; EXECUTE IMMEDIATE "DELETE FROM Employees WHERE EmployeeID = 160"; EXECUTE IMMEDIATE "PREPARE TO COMMIT";
The following sequence of statements does not cause an error when the delete statement is executed, even though it causes integrity violations. The PREPARE TO COMMIT statement returns an error.
SET OPTION wait_for_commit= 'On'; DELETE FROM GROUPO.Departments WHERE DepartmentID = 100; PREPARE TO COMMIT;