我正在尝试创建这样的新触发器。但它给了我一个错误。
DELIMITER $$
CREATE TRIGGER email_postid_truncate BEFORE INSERT
ON email_postid
BEGIN
SET @cnt = (SELECT count(*) FROM email_postid WHERE status='Remaining');
IF @cnt = 0 THEN
--My query
END IF;
END $$
DELIMITER ;
此触发器会出现如下错误
请帮忙。
答案 0 :(得分:1)
您错过了FOR EACH ROW
statement
CREATE TRIGGER email_postid_truncate BEFORE INSERT
ON email_postid
FOR EACH ROW
BEGIN
....