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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -