Multiple events in one MySQL trigger -


i want monitor multiple events on 1 table using mysql trigger. when these events happened, can on database. codes below can accomplish task:

drop trigger if exists trigger_sample1;;   create trigger trigger_sample1   after update on table_1 each row   begin       /* */   end ;;   drop trigger if exists trigger_sample2;;   create trigger trigger_sample2   after insert on table_1 each row   begin       /* */   end ;;   drop trigger if exists trigger_sample3;;   create trigger trigger_sample3   after delete on table_1 each row   begin       /* */   end ;;  

but wish combine these triggers 1 trigger. tried code like:

drop trigger if exists trigger_sample;;   create trigger trigger_sample   after update, insert, delete on table_1 each row   begin       /* */   end ;;   

this can not work.i tried:

drop trigger if exists trigger_sample;;   create trigger trigger_sample   after update on table_1   after insert on table_1   after delete on talble_1   each row   begin       /* */   end ;;   

this neither work. there advice?

you can actually.

create or replace trigger trigger_sample   after update or insert or delete on table_name  each row   begin       /* */   end; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -