Can we call a single trigger for multiple tables....

say I have two identical tables a and b.

now we have a trigger that is needed to be called by each table.

It is possible in POSTGRESQL using Triggers function....

these functions allow to call a single trigger function from multiple tables....

Is it possible in mysql???

Recommended Answers

All 2 Replies

I think you could code a stand-alone procedure and call this procedure from your different triggers. But you cannot define one trigger for multiple tables in MySQL.
Maybe it's possible with an ugly hack. In MySQL 5.1 triggers are stored as external files. You might link several of those files to the same source.

I have already tried that!!

I have created a procedure and then called it through the triggers....but then I have to send all the 92 column of the table as a parameters....and in each table there are more than 5 lac record so it is consuming lot of time as a result of which processing gets very slow....

However i haven't used mysql5.1, will look into it...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.