how to use a block of commands in triggers

53 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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...