我有程序:

    CREATE PROCEDURE channge_max_priority()
    BEGIN
      update feeds set max_post_priority =
        (
            select max(feed_posts.priority)
            from feed_posts
            where feed_posts.feed_id = feed_id
        )
        where feeds.id = feed_id;
    END


我想创建三个触发器:

      CREATE TRIGGER feed_post_after_test AFTER INSERT (And update and delete ) ON feed_posts
      FOR EACH ROW EXECUTE PROCEDURE change_max_priority();


该程序正常工作,但是当我尝试启动触发器时,出现错误:

Error in query (1064): Syntax error near 'PROCEDURE change_max_priority()' at line 2

最佳答案

您在名称过程中有一个双nn

替换:

CREATE PROCEDURE channge_max_priority()


通过

CREATE PROCEDURE change_max_priority()

关于mysql - 添加触发器时的语法错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47133107/

10-13 03:17