MySQL Forums
Forum List  »  Triggers

Check for existence of a trigger
Posted by: CMS
Date: March 10, 2005 04:23PM

(Using 5.0.2-alpha-max)

For tables, you can conditionally drop them. That is, drop them if they exist, or do nothing if they don't.

For example:

The DROP TRIGGER statement doesn't seem to support the "IF EXISTS" clause. And since attempting to drop a trigger that does not exist causes a 1360 error (Trigger does not exist) and aborts my script, I can't simply have the script try to drop a trigger without know if it's there or not.

In Oracle, I think I could do a "CREATE OR REPLACE". In SQL Server, I could just peek in the sysobjects table to see if an object exists or not. I don't see anything in MySQL where I can look at the object inventory.

Is this just an oversight because I'm using a pre-release version of MySQL or am I just missing the way to see if a trigger already exists?


Options: ReplyQuote

Written By
Check for existence of a trigger
March 10, 2005 04:23PM

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.