List:General Discussion« Previous MessageNext Message »
From:Rob Hall Date:October 7 2005 2:24pm
Subject:Generating an Error in a Trigger
View as plain text  
How do I generate an error condition within a Trigger? 

This might sound a strange request to some but I'm trying to do input 
validation on an insert/update query using a trigger. If the validation fails 
I need to set an error condition such that MySQL will not Insert/Ammend the 
data. Whilst I could force 'sensible' defaults in the event of validation 
failure I'd prefer to dump the entire record as being 'out of bounds'. The 
manual states that when an error occurs within a trigger the table data isn't 
modified which is exactly the behaviour I want. Unfortunately the manual 
doesn't state how to generate an error (safely). 

Best regards,
 Rob Hall - Red Hat Certified Engineer
 Technical Team Leader
 Newsquest Digital Media
Generating an Error in a TriggerRob Hall7 Oct
  • Re: Generating an Error in a TriggerPeter Brawley7 Oct