我的 MariaDB 版本是 10.32,数据库工具是 DBeaver。我正在尝试创建在 DO 子句中包含复合语句语法的计划事件,但发生以下错误。我想知道语法错误是什么。
SQL Error [1064] [42000]: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 9
这是我使用的 sql,它来自MySQL 文档中的预定事件。
delimiter |
CREATE EVENT e_daily
ON SCHEDULE
EVERY 1 DAY
COMMENT 'Saves total number of sessions then clears the table each day'
DO
BEGIN
INSERT INTO site_activity.totals (time, total)
SELECT CURRENT_TIMESTAMP, COUNT(*)
FROM site_activity.sessions;
DELETE FROM site_activity.sessions;
END |
delimiter ;