#1064 - 您的 SQL 语法有误;查看与您的 MariaDB 服务器版本对应的手册,了解在 '' 附近使用的正确语法
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''
/* Create trigger for Message system*/
CREATE TRIGGER IF NOT EXISTS TRG_MSG
AFTER INSERT ON Order_Detail
FOR EACH ROW
BEGIN
INSERT INTO Messages (Order_ID, Member_ID, Message, Msg_Date)
VALUES (new.Order_ID, new.Member_ID, 'Your Order is Placed!...', CURRENT_DATE);
END;
在 MySQL 中,我收到此错误...
使用分隔符
喜欢
DELIMITER //
CREATE TRIGGER IF NOT EXISTS TRG_MSG
AFTER INSERT ON Order_Detail
FOR EACH ROW
BEGIN
INSERT INTO Messages (Order_ID, Member_ID, Message, Msg_Date)
VALUES (NEW.Order_ID, NEW.Member_ID, 'Your Order is Placed!...', CURRENT_DATE);
END;
DELIMITER ;
MySQL的CREATE TRIGGER
syntax不支持IF NOT EXISTS
选项。
此外,您需要在创建触发器之前重新定义 DELIMITER
,因此触发器主体中嵌入的 ;
不会与周围的 create trigger
语句冲突.
DELIMITER //
CREATE TRIGGER RG_MSG
AFTER INSERT ON Order_Detail
FOR EACH ROW
BEGIN
INSERT INTO Messages (Order_ID, Member_ID, Message, Msg_Date)
VALUES (new.Order_ID, new.Member_ID, 'Your Order is Placed!...', CURRENT_DATE);
END//
DELIMITER ;
/* Create trigger for Message system*/
CREATE TRIGGER IF NOT EXISTS TRG_MSG
AFTER INSERT ON Order_Detail
FOR EACH ROW
BEGIN
INSERT INTO Messages (Order_ID, Member_ID, Message, Msg_Date)
VALUES (new.Order_ID, new.Member_ID, 'Your Order is Placed!...', CURRENT_DATE);
END;
在 MySQL 中,我收到此错误...
使用分隔符
喜欢
DELIMITER //
CREATE TRIGGER IF NOT EXISTS TRG_MSG
AFTER INSERT ON Order_Detail
FOR EACH ROW
BEGIN
INSERT INTO Messages (Order_ID, Member_ID, Message, Msg_Date)
VALUES (NEW.Order_ID, NEW.Member_ID, 'Your Order is Placed!...', CURRENT_DATE);
END;
DELIMITER ;
MySQL的CREATE TRIGGER
syntax不支持IF NOT EXISTS
选项。
此外,您需要在创建触发器之前重新定义 DELIMITER
,因此触发器主体中嵌入的 ;
不会与周围的 create trigger
语句冲突.
DELIMITER //
CREATE TRIGGER RG_MSG
AFTER INSERT ON Order_Detail
FOR EACH ROW
BEGIN
INSERT INTO Messages (Order_ID, Member_ID, Message, Msg_Date)
VALUES (new.Order_ID, new.Member_ID, 'Your Order is Placed!...', CURRENT_DATE);
END//
DELIMITER ;