首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mysql:无法识别的语句类型。(接近计划)当尝试创建事件计划时

问mysql:无法识别的语句类型。(接近计划)当尝试创建事件计划时
EN

Stack Overflow用户
提问于 2015-11-23 07:59:45
回答 2查看 10.2K关注 0票数 2

我正在尝试创建事件调度,但是phpmyadmin在左边的无法识别的语句类型上显示了错误。(接近时间表)‘。MySql版本为10.1.8。我真的不明白这段代码、MySql/phpmyadmin或任何其他配置有什么问题。

代码语言:javascript
复制
    DELIMITER $$
    CREATE 
        EVENT `archive_blogs` 
        ON SCHEDULE
        EVERY 1 DAY
        STARTS '20:00:00' ON COMPLETION PRESERVE ENABLE 
        DO BEGIN
            .....
        END */$$
    DELIMITER ;

快照错误:无法识别的语句类型。(近附表)

​

​

EN

回答 2

Stack Overflow用户

发布于 2015-11-23 08:33:03

MySql版本为10.1.8

你确定是MySQL吗?可能是MariaDB?你从哪里得到这个错误脚本,phpMyAdmin?你有没有试着按照协议执行?

至于

代码语言:javascript
复制
STARTS '20:00:00'

试试下面的insted

代码语言:javascript
复制
STARTS CONCAT(DATE(NOW()+INTERVAL 1 DAY ), ' 20:00:00')

来自MySQL文档:

代码语言:javascript
复制
To repeat actions at a regular interval, use an EVERY clause. The EVERY keyword is followed by an interval as described in the previous discussion of the AT keyword. (+ INTERVAL is not used with EVERY.) For example, EVERY 6 WEEK means “every six weeks”.

Although + INTERVAL clauses are not permitted in an EVERY clause, you can use the same complex time units permitted in a + INTERVAL.

An EVERY clause may contain an optional STARTS clause. STARTS is followed by a timestamp value that indicates when the action should begin repeating, and may also use + INTERVAL interval to specify an amount of time “from now”. For example, EVERY 3 MONTH STARTS CURRENT_TIMESTAMP + INTERVAL 1 WEEK means “every three months, beginning one week from now”. Similarly, you can express “every two weeks, beginning six hours and fifteen minutes from now” as EVERY 2 WEEK STARTS CURRENT_TIMESTAMP + INTERVAL '6:15' HOUR_MINUTE. Not specifying STARTS is the same as using STARTS CURRENT_TIMESTAMP—that is, the action specified for the event begins repeating immediately upon creation of the event.

An EVERY clause may contain an optional ENDS clause. The ENDS keyword is followed by a timestamp value that tells MySQL when the event should stop repeating. You may also use + INTERVAL interval with ENDS; for instance, EVERY 12 HOUR STARTS CURRENT_TIMESTAMP + INTERVAL 30 MINUTE ENDS CURRENT_TIMESTAMP + INTERVAL 4 WEEK is equivalent to “every twelve hours, beginning thirty minutes from now, and ending four weeks from now”. Not using ENDS means that the event continues executing indefinitely.

ENDS supports the same syntax for complex time units as STARTS does.

You may use STARTS, ENDS, both, or neither in an EVERY clause.
票数 2
EN

Stack Overflow用户

发布于 2015-11-23 08:40:32

试试这个,它似乎也想要个约会。

代码语言:javascript
复制
DELIMITER $$
CREATE EVENT `archive_blogs` 
    ON SCHEDULE
    EVERY 1 DAY
    STARTS '2015-11-23 20:00:00' 
    ON COMPLETION PRESERVE ENABLE 
    DO 
        select 8 as 'eight';
    $$
DELIMITER ;

在我的系统里。

创建事件手册页。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33866093

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档