MySQL Forums
Forum List  »  Triggers

Re: Enforce business rule with before insert trigger?
Posted by: Andrew Gilfrin
Date: April 17, 2005 04:00PM

I came across the same problem when writing content for my web site. I was writting a section on how you could use triggers to emulate check constraints in a similar way to you.

However I hit a wall when trying to find a solution to this problem. The only way I could see to do this is artificially raise an error for example by accessing a table that doesn't exist, but as you can't compile a trigger with SQL I was finding it difficult to find an alternative.

Anyway this method is really not very good because the error message raised would not be consistent with the problem.

In the end I gave up as it seemed to be too much messing around for an inferior solution.

I think the crux for you post is this line "also making sure I'm passing some sort of coherent message back to the user" thats the real problem and thats why I decided any solution would not be suitable.

Andrew Gilfrin
------------------
http://gilfster.blogspot.com
My MySQL related Blog

http://www.mysqldevelopment.com
MySQL Stored Procedure,Trigger, View.... (Just about most things these days) Information

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Enforce business rule with before insert trigger?
4210
April 17, 2005 04:00PM


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.