Rollback in Oracle and SQL Server
- by CatherineRussell
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