ABORT

Name

ABORT  --  Aborts the current transaction

Synopsis

ABORT [ WORK | TRANSACTION ]
  

Inputs

WORK

Optional keyword. Has no effect.

TRANSACTION

Optional keyword. Has no effect.

Outputs

ROLLBACK

Message returned if successful.

NOTICE: ROLLBACK: no transaction in progress

Message returned if no transaction is in progress.

Description

ABORT rolls back the current transaction and causes all the updates made by the transaction to be discarded. This command is identical in behavior to the SQL92 command ROLLBACK, and is present only for historical reasons.

Notes

Use COMMIT to successfully terminate a transaction.

Usage

To abort all changes:
CREATE TABLE t1 (
   i1 integer
);
INSERT INTO t1 (i1) VALUES (1);
INSERT INTO t1 VALUES (2);
BEGIN;
DELETE FROM t1;
ABORT; –– to abort changes
SELECT * FROM t1;
   
Result:
 t1
---
 1
 2

Compatibility

SQL92

There is no ABORT statement in SQL92. ROLLBACK is the SQL92 equivalent command.