Collections:
Rollback the Current Transaction in Oracle
How To Rollback the Current Transaction in Oracle?
✍: FYIcenter.com
If you have used some DML statements updated some data objects, you find a problem with those updates, and you don't want those updates to be permanently recorded in the database, you can use the ROLLBACK statement. It will remove all the database changes made in the current transaction and end the current transaction. The following tutorial exercise shows you how to use ROLLBACK statements:
SQL> connect HR/fyicenter
SQL> INSERT INTO fyi_links (url, id)
2 VALUES ('google.com', 102);
SQL> INSERT INTO fyi_links (url, id)
3 VALUES ('myspace.com', 103);
SQL> SELECT * FROM fyi_links;
ID URL NOTES COUNTS CREATED
------- ---------------- ---------- ---------- ---------
101 fyicenter.com 07-MAY-06
110 centerfyi.com 07-MAY-06
102 google.com 07-MAY-06
103 myspace.com 07-MAY-06
SQL> ROLLBACK;
Rollback complete.
SQL> SELECT * FROM fyi_links;
ID URL NOTES COUNTS CREATED
------- ---------------- ---------- ---------- ---------
101 fyicenter.com 07-MAY-06
110 centerfyi.com 07-MAY-06
As you can see, the two new records inserted into the table were removed by the ROLLBACK statement.
⇒ Transaction Commit When DDL Statement Executed in Oracle
⇐ Commit the Current Transaction in Oracle
2019-09-04, 2450🔥, 0💬
Popular Posts:
How To Revise and Re-Run the Last SQL Command in Oracle? If executed a long SQL statement, found a m...
How To Divide Query Output into Multiple Groups with the GROUP BY Clause in SQL Server? Sometimes, y...
How To Set Up SQL*Plus Output Format in Oracle? If you want to practice SQL statements with SQL*Plus...
How Fixed Length Strings Are Truncated and Padded in SQL Server Transact-SQL? When the length of the...
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows,...