SQL Trigger(as)不是此位置错误的有效输入 – MySQL
作者:互联网
我不知道为什么我会继续
the error on line number 3. (as) is not a valid input at this
position?
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
解决方法:
你必须添加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 ;
标签:mysql,sql,database-trigger 来源: https://codeday.me/bug/20190627/1304494.html