Version 6.3.8 for OpenVMS
 —  Statements  —

ROLLBACK - SQL

ROLLBACK

This document covers the following topics:

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.

Belongs to Function Group: Database Access and Update


Function

The SQL statement ROLLBACK corresponds to the Natural statement BACKOUT TRANSACTION. It undoes all database modifications made since the beginning of the last recovery unit. A recovery unit may start either after the beginning of a session or after the last SYNCPOINT, COMMIT, END TRANSACTION or BACKOUT TRANSACTION statement. This statement also releases all records held during the transaction.

If a program tries to backout updates which have already been committed by a terminal I/O, a corresponding Natural error message (NAT3711) is returned.

Warning:
As all cursors are closed when a logical unit of work ends, a ROLLBACK statement must not be placed within a database modification loop; instead, it has to be placed outside such a loop or after the outermost loop of nested loops.

Top of page

Consideration for Non-Natural Programs

If an external program written in another standard programming language is called from a Natural program, this external program should not contain its own ROLLBACK statement if the Natural program issues database calls, too. The calling Natural program should issue the ROLLBACK statement on behalf of the external program.

Top of page

Example

...
DELETE FROM SQL-PERSONNEL WHERE NAME = 'SMITH' 
ROLLBACK
...

Top of page