如何在 mySQL 触发器中使用 select..into 语句
How to use select..into statement inside trigger in mySQL
我收到语法错误
"select" 在此位置对于此服务器版本无效,期望:'(',带
delimiter |
CREATE TRIGGER after_temp_ticket_insert
AFTER INSERT ON temp_tickets
FOR EACH ROW begin
declare
ss varchar(5);
select system into ss from support_system where team=new.assigned_team;
INSERT INTO tickets(ticket_id,ticket_type,summary,assigned_team,assigned_to,created_by,created_date,priority,status,resolution,resolved_date,support_system,category_tier1,category_tier2)
VALUES (new.ticket_id,new.ticket_type,new.summary,new.assigned_team,new.assigned_to,new.created_by,new.created_date,new.priority,new.status,new.resolution,new.resolved_date,ss,NULL,NULL);
end
|
delimiter ;
请帮我解决这个问题。提前致谢。
系统保留字使用反引号
同时勾选 here for more information
delimiter |
CREATE TRIGGER after_temp_ticket_insert
AFTER INSERT ON temp_tickets
FOR EACH ROW begin
declare
ss varchar(5);
select `system` into ss from support_system where team=new.assigned_team;
INSERT INTO tickets(ticket_id,ticket_type,summary,assigned_team,assigned_to,created_by,created_date,priority,status,resolution,resolved_date,support_system,category_tier1,category_tier2)
VALUES (new.ticket_id,new.ticket_type,new.summary,new.assigned_team,new.assigned_to,new.created_by,new.created_date,new.priority,new.status,new.resolution,new.resolved_date,ss,NULL,NULL);
end
|
delimiter ;
我收到语法错误
"select" 在此位置对于此服务器版本无效,期望:'(',带
delimiter |
CREATE TRIGGER after_temp_ticket_insert
AFTER INSERT ON temp_tickets
FOR EACH ROW begin
declare
ss varchar(5);
select system into ss from support_system where team=new.assigned_team;
INSERT INTO tickets(ticket_id,ticket_type,summary,assigned_team,assigned_to,created_by,created_date,priority,status,resolution,resolved_date,support_system,category_tier1,category_tier2)
VALUES (new.ticket_id,new.ticket_type,new.summary,new.assigned_team,new.assigned_to,new.created_by,new.created_date,new.priority,new.status,new.resolution,new.resolved_date,ss,NULL,NULL);
end
|
delimiter ;
请帮我解决这个问题。提前致谢。
系统保留字使用反引号
同时勾选 here for more information
delimiter |
CREATE TRIGGER after_temp_ticket_insert
AFTER INSERT ON temp_tickets
FOR EACH ROW begin
declare
ss varchar(5);
select `system` into ss from support_system where team=new.assigned_team;
INSERT INTO tickets(ticket_id,ticket_type,summary,assigned_team,assigned_to,created_by,created_date,priority,status,resolution,resolved_date,support_system,category_tier1,category_tier2)
VALUES (new.ticket_id,new.ticket_type,new.summary,new.assigned_team,new.assigned_to,new.created_by,new.created_date,new.priority,new.status,new.resolution,new.resolved_date,ss,NULL,NULL);
end
|
delimiter ;