mysql触发语法错误

时间:2012-06-25 23:33:26

标签: mysql triggers

我需要正确的mysql触发器语法我正在使用5.1版 当我编写sql statment

时,语法错误alwys apper
DELIMITER $$
CREATE TRIGGER  blood_year
AFTER INSERT ON donor
FOR EACH ROW
BEGIN
INSERT INTO blood_donation (donation_year)VALUES 
(YEAR(NOW()));
 END$$

任何想法?

1 个答案:

答案 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 ;