简体   繁体   中英

Trigger - AFTER INSERT - GIVING syntax error

CREATE TRIGGER giveaccess AFTER INSERT ON `befree_user`
FOR EACH ROW BEGIN
    INSERT INTO user_access(user_id) VALUES (NEW.user_id);
END;

you need to define another delimiter than ;

delimiter |

   CREATE TRIGGER giveaccess AFTER INSERT ON `befree_user`
   FOR EACH ROW BEGIN
         INSERT INTO user_access(user_id) VALUES (NEW.user_id);
   END;

|
delimiter ;

If not the DB thinks that after the first ; the statement is done and will throw an error.

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