Contents IndexPREPARE statement PUT statement

User's Guide
   Part VI. SQL Anywhere Reference
     Chapter 43. Watcom-SQL Statements
      PREPARE TO COMMIT statement

Function

To check whether a COMMIT can be performed.

Syntax

     PREPARE TO COMMIT

Usage

Anywhere.

Permissions

None.

Side effects

None.

See also

Description

The PREPARE TO COMMIT statement tests whether a COMMIT can be performed successfully. The statement will cause an error if a COMMIT is not possible without violating the integrity of the database.

Examples

     EXECUTE IMMEDIATE "SET OPTION wait_for_commit = 'on'";
     EXECUTE IMMEDIATE "DELETE FROM employee
     WHERE emp_id = 160";
     EXECUTE IMMEDIATE "PREPARE TO COMMIT";

The following sequence of statements allows the delete to take place, even though it causes integrity violations. The PREPARE TO COMMIT statement causes an error reporting the violation.

     SET OPTION wait_for_commit= 'ON' ;
     DELETE
     FROM department
     WHERE dept_id = 100 ;
     PREPARE TO COMMIT ;

Contents IndexPREPARE statement PUT statement