Rollback in Oracle and SQL Server
Posted
by CatherineRussell
on Geeks with Blogs
See other posts from Geeks with Blogs
or by CatherineRussell
Published on Mon, 14 Jun 2010 23:45:04 GMT
Indexed on
2010/06/15
5:53 UTC
Read the original article
Hit count: 250
I have an Oracle background. It was interesting to see how rollback handled in Oracle and SQL Server.
There is no begin trans in Oracle. What oracle does is it will store the data in a temporary area called the rollback segments. Untill your issue the commit command the records will be kept there. You can even rollback your update statement by issuing the rollback command. When you issue the commit command the records in the rollback segments are written to the redo log files. The same logic for insert is also applicable except that there is no mirror image of the record kept.
In SQL Server, if you want to be able to roll back statement, you neet to start your statement with a "begin tran" .
Then, you can rollback a transaction, if this is needed.
begin tran
update Person set FirstName = 'Arthur'
where PersonId = 10
-- select firstname from Person
rollback
© Geeks with Blogs or respective owner