HP 3000 Manuals

COMMIT WORK [ ALLBASE/SQL Reference Manual ] MPE/iX 5.5 Documentation


ALLBASE/SQL Reference Manual

COMMIT WORK 

The COMMIT WORK statement ends the current transaction.  All changes made
during the transaction are committed (made permanent).

Scope 

ISQL or Application Programs

SQL Syntax 

COMMIT WORK [RELEASE]

Parameters 

RELEASE                 terminates your DBE session after the changes
                        made during the transaction are committed.
                        Specifying RELEASE has the same effect as issuing
                        a COMMIT WORK statement followed by a RELEASE
                        statement.

Description 

   *   The COMMIT WORK statement has no effect if you do not have a
       transaction in progress.

   *   The COMMIT WORK statement releases all locks held by the
       transaction, except those associated with a kept cursor in an
       application program.

   *   In an application program, the COMMIT WORK statement closes all
       cursors opened without the KEEP CURSOR option in the current
       transaction.

   *   For cursors opened with the KEEP CURSOR option, the COMMIT WORK
       statement (but not the COMMIT WORK RELEASE statement) implicitly
       starts a new transaction that maintains the current cursor
       position and inherits the isolation level.  Whether or not locks
       on data objects pointed to by these cursors are released depends
       on the use of the WITH LOCKS or WITH NOLOCKS option in the OPEN
       statement.

   *   If a procedure invoked by a rule executes a COMMIT WORK statement,
       an error occurs.

   *   If a commit is done while constraints are deferred, and constraint
       errors exist, the system will roll back the transaction and report
       that constraint errors exist.

   *   Short transactions (frequent COMMIT WORK statements) are
       recommended to improve concurrency.

   *   If RELEASE is used, all cursors are closed and the current
       connection is terminated

   *   The RELEASE option is not allowed within a procedure.

Authorization 

You do not need authorization to use the COMMIT WORK statement.

Example 

Transaction begins.

     BEGIN WORK

     statement-1 

     SAVEPOINT :MyVariable

     statement-2 

     statement-3 

Work of statements 2 and 3 is undone.

     ROLLBACK WORK TO :MyVariable

Work of statement 1 is committed; the transaction ends.

      COMMIT WORK 



MPE/iX 5.5 Documentation