我正在编写一个插入后触发器,它将数据插入到list_of_requests表中,从emp_sup表中获取数据。
create trigger trig_lor
after insert
on employee_skillset
for each row begin
insert into list_of_requests (APPROVER1,APPROVER2,LOGDATE)
select sup1,sup2,'#dateFormat(now(),"yyyy/mm/dd")#' from empsup
where empno=NEW.employee_number
end
这是错误:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'trigger trig_lor after insert on employee_skillset for each row begin inse' at line 1
我如何使这项工作?
答案 0 :(得分:0)
未经测试但试一试。
delimiter //
drop trigger if exists trig_lor //
create trigger trig_lor
after insert
on employee_skillset
for each row
begin
insert into list_of_requests (APPROVER1,APPROVER2,LOGDATE)
select sup1,sup2,curdate() from empsup where empno=NEW.employee_number;
end; //
delimiter ;