MySQL Forums
Forum List  »  InnoDB

Is partial Rollback Possible?
Posted by: Sam Njogu
Date: January 14, 2009 06:25AM

Hi.
I'm using mysql 5.0 on windows XP.I was trying to use transactions to insert into a new table2 the changes made in table1 and then effect a ROLLBACK so that the initial update is not effected. However the rollback affects the insert into table2 as well. The logic is something like this :

START TRANSACTION;
UPDATE table1
SET fields=values;

WHILE LOOP
SET @updates=CONCAT('INSERT INTO table2
(field1,field2)
VALUES(val1,val2)');
PREPARE s1 FROM @updates;
EXECUTE s1;
DEALLOCATE PREPARE s1;
END WHILE;
ROLLBACK;

How can i ensure the changes to table2 are committed and those to table1 are rolled back?

Thanks in advance.
Regards.

Options: ReplyQuote


Subject
Views
Written By
Posted
Is partial Rollback Possible?
4865
January 14, 2009 06:25AM
2267
January 14, 2009 11:10AM
2186
January 14, 2009 01:12PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.