ROLLBACK statement (Cancel transaction)

Function

The ROLLBACK statement cancels the current transaction and nullifies the database updating performed by the transaction.

Privileges

None.

Format

ROLLBACK [WORK] [RELEASE]

Operands

This operand has no effect on the transaction cancellation function of the ROLLBACK statement. The WORK operand is supported for compatibility with JIS standards.

Specifies that the UAP is to be disconnected from the HiRDB after the transaction has been canceled and database updates have been nullified.

Common rules

  1. The ROLLBACK statement closes all cursors that are currently open.
  2. The ROLLBACK statement resets any lock controls that were put into effect during the current transaction. However, lock controls set by a LOCK TABLE statement with UNTIL DISCONNECT specified are not reset.
  3. Definition SQL statements are not subject to rollback.
  4. Preprocessing of a dynamic SELECT statement with holdable cursor specification is nullified if it was performed during the current transaction. In other cases, the preprocessing remains effective.
  5. Executing the ROLLBACK statement nullifies all effective locators.

Notes

  1. The ROLLBACK statement cannot be specified from an X/Open compliant UAP running under OLTP. Similarly, if a procedure is called from a UAP running under OLTP, procedures using the ROLLBACK statement cannot be executed.
  2. When executing the ROLLBACK statement from a procedure, you cannot specify the RELEASE operand.
  3. The ROLLBACK statement cannot be executed during trigger action.

Examples

  1. Cancel the current transaction:

    ROLLBACK

  2. Cancel the transaction either within a procedure of after the procedure has terminated:

    [Figure]