MySQL Forums
Forum List  »  Triggers

Triggers With Transactions
Posted by: chris gutierrez
Date: August 03, 2006 01:51PM

Hello!

This may or may not be a silly question...

is it possible to use triggers along side transactions and still have the triggered queries reap the benefits of the transaction?

I suppose an example would be...

/* start a transaction */
BEGIN
INSERT INTO sometable (col1,col2) VALUES (val1,val2);
INSERT INTO sometable2 (col1,col2) VALUES (val1,val2);
COMMIT

now lets say that the second insert statement fails, hence causing the transaction to fail.

if 'sometable' has a BEFORE INSERT or AFTER INSERT trigger on it, should that action, be it another insert or update, even a delete, get rolled back along with the rest of the transaction?

Options: ReplyQuote


Subject
Views
Written By
Posted
Triggers With Transactions
2555
August 03, 2006 01:51PM
1644
August 25, 2006 01:28PM


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.