简体   繁体   中英

how to use a block of commands in triggers

The following code works

CREATE
TRIGGER rebuild_course_auto_enrollment_tree_mv AFTER INSERT
ON course_auto_enrollment FOR EACH ROW  
DELETE FROM
cron_event_tasks;

If I add the BEGIN ... END as written in the documentation

 CREATE
    TRIGGER rebuild_course_auto_enrollment_tree_mv AFTER INSERT
    ON course_auto_enrollment FOR EACH ROW 
    BEGIN 
    DELETE FROM
    cron_event_tasks;
    END;

This is not working, hmmmm...What am I missing?

Stupid me. I am using phpmyadmin, and it uses the ; as the delimiter to separate queries.
Solution: change in the query window of phpmyadmin the delimiter to something else and wallah...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM