Thread: on ignore
View Single Post
Old 12-19-2012, 12:49 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,565
Thanks: 62
Thanked 4,057 Times in 4,026 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
I don't know a way to do it.

But one easy way would be to use a Stored Procedure and forget about the trigger.

In the Procedure, you would attempt the INSERT and, if you get an error from it, then do the other operation (e.g, put data into another table).

I think triggers are over-used and stored procedures are under-used, especially with MySQL.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote