| Author |
does any one know how i can delete a trigger if it exist in mysql ?
|
raminaa niilian
Ranch Hand
Joined: Jul 14, 2005
Posts: 550
|
|
Hi thank you for reading my post i am trying to make it possible to use an script file to inject all triggers that i need into database. but problem is that if a trigger is already there i can not check for its existance . when i can not check for its existence then i do not know whether i should have a drop trigger statement or not. Mysql does not support Drop if exisits for triggers. i want a clone for drop if exisits TRIGGER_NAME or Create or replace triger commands. Thank you very much. any comment ?
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26193
|
|
Raminaa, See this page where someone suggested doing a count first.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
raminaa niilian
Ranch Hand
Joined: Jul 14, 2005
Posts: 550
|
|
Thank you for you reply. I saw that post before , my problem is that i do not know how i can use that sql statement , i know that it return the count of rows with the same trigger name , then i do not know how i can use that count in sql statement. if it was using java simpley i check the first column of first row then i could execute a drop trigger statement. now i can not do it in my sql script file  do you have any idea about using it in an sql script ? thanks
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26193
|
|
Originally posted by raminaa niilian: do you have any idea about using it in an sql script ?
In a SQL script, we usually just do the drop unconditionally and ignore the errors about the table not being defined.
|
 |
 |
|
|
subject: does any one know how i can delete a trigger if it exist in mysql ?
|
|
|