Use this statement to check 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.
SQL/2003 Vendor extension.
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 Departments WHERE DepartmentID = 100; PREPARE TO COMMIT;
|Envoyer votre avis sur cette page par email.||Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|