MYSQL错误1064:创建事件

时间:2016-08-22 15:38:10

标签: mysql

还是MySQL新手。我的语法在哪里出错?

CREATE EVENT `event_name` ON SCHEDULE EVERY 15 MINUTE ON COMPLETION PRESERVE
DO
BEGIN
INSERT INTO table_1 (column_name) SELECT column FROM table_1 WHERE column REGEXP 'regex_string'
END;

1 个答案:

答案 0 :(得分:0)

删除BEGINEND,因为它不是复合语句,如果您的列名是column,则将其转义为

CREATE EVENT `event_name` ON SCHEDULE EVERY 15 MINUTE ON COMPLETION PRESERVE
DO
INSERT INTO table_1 (column_name) 
   SELECT `column` FROM table_1 
   WHERE `column` REGEXP 'regex_string';

参考MySQL Documentation