我需要正确的mysql触发器语法我正在使用5.1版 当我编写sql statment
时,语法错误alwys apperDELIMITER $$
CREATE TRIGGER blood_year
AFTER INSERT ON donor
FOR EACH ROW
BEGIN
INSERT INTO blood_donation (donation_year)VALUES
(YEAR(NOW()));
END$$
任何想法?
答案 0 :(得分:1)
尝试在最后添加另一个“DELIMITER”语句:
DELIMITER $$
CREATE TRIGGER blood_year
AFTER INSERT ON donor
FOR EACH ROW
BEGIN
INSERT INTO blood_donation (donation_year)VALUES (YEAR(NOW()));
END$$
DELIMITER ;