mysql定义触发器错误,:[Err] 1415 - Not allowed to return a result set from a trigger
DROP TRIGGER IF EXISTS t_afterupdate_on_borrowinfo;
CREATE TRIGGER t_afterupdate_on_borrowinfo
AFTER UPDATE ON borrowinfo
FOR EACH ROW
BEGIN
DECLARE day int;
select to_days(curdate())-to_days (back_date )as day from borrowinfo;
update borrowinfo set overdue_day=days where day>0;
update borrowinfo set fines=days*0.1 where day>0;
END;
定义了一个触发器,目的是:当当前日期超过应归还日期时,把表中的过期天 置为两个日期的差值,罚款 为fines=days*0.1 、、、
执行后错误是:[Err] 1415 - Not allowed to return a result set from a trigger
求指导,刚接触mysql,写的乱七八糟
------解决方案--------------------
select to_days(curdate())-to_days (back_date ) into day from borrowinfo;
------解决方案--------------------
PHP code
DROP TRIGGER IF EXISTS t_afterupdate_on_borrowinfo;
CREATE TRIGGER t_afterupdate_on_borrowinfo
AFTER UPDATE ON borrowinfo
FOR EACH ROW
BEGIN
DECLARE day int;
select to_days(curdate())-to_days (back_date )into day from borrowinfo;
update borrowinfo set overdue_day=day where day>0;
update borrowinfo set fines=day*0.1 where day>0;
END;