MySQL Forums
Forum List  »  Triggers

Re: fetch updated columns in 'before update' trigger
Posted by: Peter Brawley
Date: September 05, 2019 09:57PM

> 'delete and recreate updated trigger'

Can't be done while the Trigger is being invoked.

> I don't want to have to modify my trigger every time I add a column

SQL isn't a complete computer language, Triggers and much else need specific table & column specs. And, in a correctly designed database, DDL changes should be rare except when the requirement changes enough to require a major upgrade, so if you expect to be adding columns often, what problem drives that expectation?

> list of updated columns

You'd need to code that yourself, eg by storing a copy of the Update statement in a table and having the Trigger retrieve and parse it. But it might not be helpful---MySQL doesn't support dynamic SQL in Triggers.

Options: ReplyQuote

Written By
Re: fetch updated columns in 'before update' trigger
September 05, 2019 09:57PM

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.