MySQL Forums
Forum List  »  Triggers

Triggers usage
Posted by: Purnelle St├ęphane
Date: August 30, 2016 10:20AM

Hi

I have a trigger (AFTER INSERT) who run fine.
This trigger find if data on a table exist and insert or update (depending if data exist or no in this table) but I need to do the same things for a other table (eg: data2). I think that do that in same trigger is complex. So I want to do this :

A trigger on source table who insert data on a other tables (eg : tmp1 and tmp2) and a trigger on table tmp1 will insert/update data on table data1.

A example :
insert into main_source values(1,2,3,4)
trigger on table main_source action will do :
insert into source1 values(NEW.A,NEW.B,NEW.C,NEW.D)
insert into source2 values(NEW.A,NEW.B,NEW.C,NEW.D)

trigger on table source1 will do : insert or udpdate on table etiean
trigger on table source2 will do : insert or udpdate on table etisscc

Is a good idea or not ?

I know that mysql 5.7 can have multiple trigger, but some change in mysql 5.7 (password and date test) will cause problem in my actual configuration.

Options: ReplyQuote


Subject
Views
Written By
Posted
Triggers usage
845
August 30, 2016 10:20AM


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.