Contents Index sa_audit_string system procedure sa_conn_activity system procedure

ASA SQL Reference
  System Procedures and Functions
    System and catalog stored procedures

sa_check_commit system procedure


Function 

Checks for outstanding referential integrity violations before a commit.

Syntax 

sa_check_commit( out_table_nameout_key_name )

Permissions 

None

Side effects 

None

See also 

WAIT_FOR_COMMIT option [database]

CREATE TABLE statement

Description 

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.

Examples 

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

Contents Index sa_audit_string system procedure sa_conn_activity system procedure