MySQL Triggers and Procedure -
MySQL Triggers and Procedure -
i have 3 tables shown below:
i have written mysql trigger phone call procedure alter delivery channel of mod whenever delivery channel of pac changes. there many many relationship between 2 have pac_mods table.
trigger:
delimiter $$ create trigger pac_delivery_channel_change_trigger after update on pacs each row begin if new.delivery_channel <> old.delivery_channel phone call updatemods(old.id, new.delivery_channel); end if; end; $$
and procedure:
delimiter $$ create procedure updatemods(in pacid int, in newdeliverychannelid int) begin update mods md inner bring together pac_mods pmds on pmds.mod_id = md.id set md.delivery_channel = newdeliverychannelid pmds.pac_id = pacid; end; $$
there no errors when run statements in mysql not work.
what doing wrong?
thanks
actually works, made stupid error , realized after had posted question.
the error using wrong fields in if statement in actual code ran in mysql.
i hope can help day.
thanks
mysql stored-procedures sql-update triggers
Comments
Post a Comment