wood burning stoves 2.0*
The moose likes JDBC and the fly likes does any one know how i can delete a trigger if it exist in mysql ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "does any one know how i can delete a trigger if it exist in mysql ?" Watch "does any one know how i can delete a trigger if it exist in mysql ?" New topic
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: 551
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: 30138
    
150

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: 551
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: 30138
    
150

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: does any one know how i can delete a trigger if it exist in mysql ?
 
Similar Threads
How to not open a named regular window if it already exisits
MySQL Triggers
Commit problem
calling trigger from java program
equivalent of on_update current_timestamp in MSSQL.