ASA SQL Reference
System Procedures and Functions
System and catalog stored procedures
Checks for outstanding referential integrity violations before a commit.
sa_check_commit( out_table_name, out_key_name )
None
None
WAIT_FOR_COMMIT option [database]
If the database option WAIT_FOR_COMMIT is ON, or if a foreign key is defined using CHECK ON COMMIT in the CREATE TABLE statement, you can update the database in such a way as to violate referential integrity, as long as these violations are resolved before the changes are committed.
You can use the sa_check_commit system procedure to check whether there are any outstanding referential integrity violations before attempting to commit your changes.
The returned parameters indicate the name of a table containing a row that is currently violating referential integrity, and the name of the corresponding foreign key index.
The following set of commands can be executed from Interactive SQL. It deletes rows from the department table in the sample database, in such a way as to violate referential integrity. The call to sa_check_commit checks which tables and keys have outstanding violations, and the rollback cancels the change:
SET TEMPORARY OPTION WAIT_FOR_COMMIT='ON' go DELETE FROM department go CREATE VARIABLE tname VARCHAR( 128 ); CREATE VARIABLE keyname VARCHAR( 128 ) go CALL sa_check_commit( tname, keyname ) go SELECT tname, keyname go ROLLBACK go