Home » Other » Training & Certification » Question about Rollback
Question about Rollback [message #361701] Thu, 27 November 2008 10:50 Go to next message
registereduser
Messages: 52
Registered: June 2008
Location: Toronto
Member
DELETE FROM tbl WHERE id = 3;
SAVEPOINT a;
UPDATE tbl SET col_1 = 5 WHERE id = 4;
ROLLBACK TO a;
ROLLBACK;

My question is whether "DELETE FROM tbl WHERE id = 3" has been done? Thanks.
Re: Question about Rollback [message #361702 is a reply to message #361701] Thu, 27 November 2008 11:18 Go to previous messageGo to next message
Frank Naude
Messages: 4581
Registered: April 1998
Senior Member
The first ROLLBACK will undo the UPDATE and the second will undo the DELETE.

Best regards.

Frank
Re: Question about Rollback [message #361709 is a reply to message #361701] Thu, 27 November 2008 11:47 Go to previous messageGo to next message
registereduser
Messages: 52
Registered: June 2008
Location: Toronto
Member
Thanks Frank.

That removed a doubt for me. According to text books, rollback constitutes a commit, which literally means the “rollback” only rollback to the specific savepoint and commit all statements before that savepoint.
Re: Question about Rollback [message #361710 is a reply to message #361709] Thu, 27 November 2008 12:01 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
I don't know which book you read but either you misunderstood it either it is plain wrong.
A rollback is NOT a commit in any way but as a commit it releases locks.

Regards
Michel
Re: Question about Rollback [message #362302 is a reply to message #361710] Mon, 01 December 2008 14:17 Go to previous message
registereduser
Messages: 52
Registered: June 2008
Location: Toronto
Member
Thanks a lot.
Previous Topic: How to write this procedure?
Next Topic: 1Z0-146
Goto Forum:
  


Current Time: Wed Dec 04 02:49:43 CST 2024