MySQL IF statement in a trigger- ELSE don't do anything -
i trying build trigger in mysql run after new rows inserted table. if there error detected, want write trigger table. otherwise, don't want write error table. want try , avoid adding endless blank rows.
here code:
create trigger character_validation4 after insert on address each row begin if(new.city regexp '^[^a-za-z0-9]') insert errorlog (city, mainprocessid) values("there error city", new.id)); end
but seeing error on final bracket.
can help? thanks
delimiter \\ create trigger character_validation4 after insert on address each row begin if(new.city regexp '^[^a-za-z0-9]') insert errorlog (city, mainprocessid) values("there error city", new.id); end if; end \\ delimiter ;
Comments
Post a Comment