mysql 创建触发器失败

输入:
CREATE TRIGGER newproducts AFTER INSERT ON products
    -> FOR EACH ROW SELECT 'Product added';
输出:

ERROR 1415 (0A000): Not allowed to return a result set from a trigger


原因:触发器 不能使用 select 来设置变量结果, 这样会返回结果集,如果在 触发器 (TRIGGER)中要写成 into 的方式。如:
SELECT'Product added';
改为:
select 'Product added' into @args;

猜你喜欢

转载自blog.csdn.net/qq_41245033/article/details/80007483
今日推荐