今天在学习mysql时,创建触发器总是不成功报这个错Not allowed to return a result set from a trigger;
比如这样创建 create trigger newproduct after insert on products for each row select 'd'; 把
后面的返回结果去掉,还是报错:
ERROR 1064 (42000): 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 '' at
比如这样创建 create trigger newproduct after insert on products for each row select 'd'; 把
后面的返回结果去掉,还是报错:
ERROR 1064 (42000): 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 '' at
line 1
------解决方案--------------------
DELIMITER //
CREATE TRIGGER newproduct AFTER INSERT ON products
FOR EACH ROW
SELECT 'd' INTO @ee;
//
DELIMITER ;