gpt4 book ai didi

MySql on update 触发器。 DELIMITER 错误

转载 作者:行者123 更新时间:2023-11-29 06:51:08 26 4
gpt4 key购买 nike

我尝试在 MySql 中创建触发器,但出现以下错误:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER' at line 1

DELIMITER $$
CREATE TRIGGER library_update
AFTER UPDATE ON wq6vt_vehiclemanager_vehicles
FOR EACH ROW
BEGIN
INSERT IGNORE INTO wq6vt_vehiclemanager_library (maker, model) VALUES(NEW.maker, NEW.vmodel);

INSERT INTO wq6vt_vehiclemanager_library_data (co2_class)
SELECT co2_class FROM wq6vt_vehiclemanager_vehicles
WHERE maker = NEW.maker AND vmodel = NEW.vmodel;
END $$
DELIMITER;

触发器中的第一个查询不会导致错误,但第二个查询会。 INSERT 中的 SELECT 有问题……我想是的

最佳答案

关键词和符号之间要有一个空格,

DELIMITER ;
-- ^ space in between here

关于MySql on update 触发器。 DELIMITER 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15360964/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com