mysql

pgky5nke  于 2021-06-25  发布在  Mysql
关注(0)|答案(1)|浏览(253)

我不知道为什么我总是
第3行的错误(as)在此位置不是有效输入?

CREATE TRIGGER PendingPublish 
AFTER INSERT ON TopicPending
    AS
BEGIN
IF NEW.TopicApproved = 'YES' THEN
INSERT INTO Topics (Title,Description,Question1,Qustion2,Question3,Question4,UserID)
VALUES (NEW.Title,NEW.Description,NEW.Question1,NEW.Question2,NEW.Question3,NEW.Question4,NEW.UserID);
END IF;
END
xe55xuns

xe55xuns1#

你必须加上 DELIMITER :
试试这个。

DELIMITER $$
CREATE TRIGGER PendingPublish 
AFTER INSERT ON TopicPending
FOR EACH ROW
BEGIN
    IF NEW.TopicApproved = 'YES' THEN
    INSERT INTO Topics (Title,Description,Question1,Qustion2,Question3,Question4,UserID)
    VALUES (NEW.Title,NEW.Description,NEW.Question1,NEW.Question2,NEW.Question3,NEW.Question4,NEW.UserID);
END IF;
END$$
DELIMITER ;

相关问题