尝试在 mysql 中创建每日事件:
CREATE EVENT ResetStatus
ON SCHEDULE
EVERY 1 DAY
DO
BEGIN
IF (DATE('2013-04-05') = CURDATE()) THEN
UPDATE mytable
SET resetstatus = 1
WHERE id = (SELECT pid FROM usertable WHERE priority = 'A');
END IF;
END;
得到一个错误:
Lookup Error - MySQL Database Error: 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 12
如果我将更新语句放入 TOAD 并运行,它运行时不会出现错误。