現行のトランザクションで行った処理を元に戻すには、ROLLBACK文を使用します。
この文に権限は必要ありません。
ROLLBACK [WORK]
ROLLBACK文では次のオプションのキーワードを使用できます。
HRスキーマのRegions表に行を挿入し、トランザクションをロールバックします。最初にautocommitを0(ゼロ)に設定します。
Command> SET AUTOCOMMIT 0;
Command> INSERT INTO Regions VALUES (5,'Australia');
1 row inserted.
Command> SELECT * FROM Regions;
< 1, Europe >
< 2, Americas >
< 3, Asia >
< 4, Middle East and Africa >
< 5, Australia >
5 rows found.
Command> ROLLBACK;
Command> SELECT * FROM Regions;
< 1, Europe >
< 2, Americas >
< 3, Asia >
< 4, Middle East and Africa >
4 rows found.