sql - Proper use of BEGIN and END in MySQL -


i switched using apache's derby database mysql , still getting familiar syntax. read documentation triggers , think followed syntax correctly. however, i'm having problems begin , end insert trigger below doesn't work if put begin , endi tried putting delimiter doesn't fix it.

create trigger copy_inserted_userid_to_allusers_permissions  after insert on allusers  each row      begin         insert allusers_admin_permissions(userid)             values(new.userid);     end; 

removing begin , end makes work i'm not able take full advantage of compound statements.

create trigger copy_inserted_userid_to_allusers_permissions  after insert on allusers  each row           insert allusers_admin_permissions(userid)             values(new.userid); 

enter image description here

i'd appreciate help. thanks.

edited:

i tried follow @ilanatos advice works returns error on first attempt. had refresh phpmyadmin page rid of error. below screenshots.

enter image description here

then if refresh page(both firefox , chrome), see trigger.

enter image description here

i don't think should return error message during execution of create trigger definition.

try using delimiter function when creating trigger.

delimiter $$  create trigger copy_inserted_userid_to_allusers_permissions  after insert on allusers  each row begin      insert allusers_admin_permissions(userid)         values(new.userid); end$$  delimiter ; 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -