Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle ROLLBACK Statement

In Oracle, the ROLLBACK statement is used to undo all changes into the database table for the current transaction.

Oracle ROLLBACK Statement Syntax

To undo all changes into the database table, use the following syntax:

Syntax

ROLLBACK [ WORK ] [ TO [SAVEPOINT] savepoint_name  | FORCE 'string' ];

Parameters:

WORK: It ROLLBACK with or without the WORK parameter will result in the same outcome.

TO SAVEPOINT : This ROLLBACK statement undoes all changes for the current session up to the savepoint.

FORCE : It is used to force the rollback of a transaction that may be corrupt or in doubt.

Oracle ROLLBACK Statement examples

The following Oracle statement shows how to issue a rollback in Oracle using the ROLLBACK statement:

Example

ROLLBACK;

OR

ROLLBACK WORK;

Note:

In the above example shows that how to issue a rollback in Oracle using the ROLLBACK statement.

Oracle ROLLBACK Savepoint examples

The following Oracle statement shows how to use the ROLLBACK to a specific savepoint:

Example

ROLLBACK TO SAVEPOINT savepoint1;

OR

ROLLBACK WORK TO SAVEPOINT savepoint1;

Note:

In the above example shows that how to use the ROLLBACK to a specific savepoint.