SQL Reference
The ROLLBACK statement is used to terminate a unit of work and back out the
database changes that were made by that unit of work.
Invocation
This statement can be embedded in an application program or issued through
the use of dynamic SQL statements. It is an executable statement that
can be dynamically prepared.
Authorization
None required.
Syntax
.-WORK--.
>>-ROLLBACK----+-------+---------------------------------------><
Description
The unit of work in which the ROLLBACK statement is executed is terminated
and a new unit of work is initiated. All changes made to the database
during the unit of work are backed out.
The following statements, however, are not under transaction control and
changes made by them are independent of issuing the ROLLBACK statement:
- SET CONNECTION,
- SET CURRENT DEGREE,
- SET CURRENT EXPLAIN MODE,
- SET CURRENT EXPLAIN SNAPSHOT,
- SET CURRENT PACKAGESET,
- SET CURRENT QUERY OPTIMIZATION,
- SET CURRENT REFRESH AGE,
- SET EVENT MONITOR STATE,
- SET PASSTHRU,
- SET PATH,
- SET SCHEMA,
- SET SERVER OPTION.
Notes
- All locks held by the unit of work are released. All open cursors
are closed. All LOB locators are freed.
- Executing a ROLLBACK statement does not affect either the SET statements
that change special register values or the RELEASE statement.
- The termination of a unit of work is an implicit rollback if the program
terminates abnormally due to a program check.
- Statement caching is affected by the rollback operation. See the Notes for information.
Example
Delete the alterations made since the last commit point or rollback.
ROLLBACK WORK
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]