Last answered:

01 Sept 2023

Posted on:

06 Jul 2023


can u explain why this isn't working? error code 1442

delimiter $$
 create trigger newwydate
 after insert on employees 
 for each row
 declare dateeeeee date;
 select hire_date into dateeeeee from employees  
 where hire_date=new.hire_date;
 if dateeeeee >date_format(sysdate(),'%y-%d-%m') then update employees set hire_date=date_format(sysdate(),'%y-%d-%m') where emp_no=new.emp_no; 
 end if;
 end $$
delimiter ;

insert into employees values("333",'2000-11-5','rambo',"stalone","M","2025-01-01"); 

1 answers ( 0 marked as helpful)
Posted on:

01 Sept 2023


I tried running your code and the trigger creates fine. However the insert statement errors out due to quotation marks you have used. 

Submit an answer