sql - trigger is not working in mysql -


i have table emppersonal in empdetails database..

i have created trigger

use empdetails;  delimiter $$ create trigger `newtirger` after insert  on `emppersonal`  each row begin  if new.mobile = null  update emppersonal set mobile = '121'; end if; end $$; 

my scenario during insert query if column mobile having null insert 121 in mobile field..

insert emppersonal(empname,empadddress,mobile,empdob) values('lop1wde','n1agar',null,null) ; 

but trigger not showing me error , not working please help.

try

use empdetails;  delimiter $$ create trigger `newtirger` after insert  on `emppersonal`  each row begin  if new.mobile null  --modify line update emppersonal set mobile = '121'; update emppersonal set mobile = '121'; end if; end $$; 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -