MySQL Forums
Forum List  »  Triggers

Re: Getting Multiple records from one Table to another after Insert
Posted by: Bob Field
Date: March 15, 2006 09:49AM

I would do it with *before* insert/update triggers, since tables cannot be reopened during trigger execution.

CREATE TRIGGER profile_before_insert
BEFORE INSERT ON Profile
FOR EACH ROW
SET new.docname = new.Documentonderwerp;

CREATE TRIGGER profile_before_update
BEFORE UPDATE ON Profile
FOR EACH ROW
SET new.docname = new.Documentonderwerp;

Basically you want a column that is always maintained as the same value as some other column. This raises the question, why have two columns at all? If some part of your application needs the column name to be different, an alias in a select statement or a view might be a better answer. Or just recode the application.

Options: ReplyQuote




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.