ROLLBACK

Name

ROLLBACK  --  Aborts the current transaction black and abandons any modifications it would have made.

Synopsis

ROLLBACK [ WORK | TRANSACTION ]
  

Parameters

This command does not accept any parameters.

Results

ABORT

This message is displayed if the transaction is aborted successfully.

NOTICE: ROLLBACK: no transaction in progress

This error is displayed if there is not a transaction in progress to rollback.

Description

Use ROLLBACK to abort a transaction in progress and discard all changes either already made or queued to be made on COMMIT.

Examples

The following example demonstrates how to rollback an accidental or unwanted delete.

 
booktown=# BEGIN WORK;
BEGIN
booktown=# DELETE FROM shipped_orders where ship_date >= '2001/1/1';
DELETE 1
booktown=# ROLLBACK WORK;