使用 ' 创建触发器插入..选择...'陈述
我正在编写一个插入后触发器,它将数据插入到 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
错误如下:您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行的“在雇员技能集上插入后触发 trig_lor,每行开始 inse”附近使用的正确语法
我该如何进行这项工作?
I am writing an after insert trigger which inserts data to list_of_requests table taking the data from emp_sup table.
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
This is giving error as: 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
How do I make this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
未测试但尝试一下。
Not tested but give it a try.