MySQL Forums
Forum List  »  Triggers

Re: Enforce business rule with before insert trigger?
Posted by: Roland Bouman
Date: December 30, 2005 08:04AM

mmm, nasty.

I understand the requirement, but its not that easy. There are two main problems:

1) you want to process a whole bunch of rows after they've all been inserted. So, you;d need a trigger for the entire insert statement. That is currently not supported. MySQL currently only supports triggers for each row - not a statement as a whole.

2) You dont really want to rollback, at least not silently. How would you know the operation failed? What you really want to do is raise an error, which will prevent the transaction from being comitted. Now, raising an error is currently not supported.

I'm thinking this over. If someone has a good solution, I'll be reading that, eager to learn as I am. But I will get back on this.

good luck!

Options: ReplyQuote

Written By
Re: Enforce business rule with before insert trigger?
December 30, 2005 08:04AM

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.