gpt4 book ai didi

mysql - 触发器创建语句不起作用+分隔符错误+mysql

转载 作者:行者123 更新时间:2023-11-29 18:37:20 26 4
gpt4 key购买 nike

以下触发器创建语句不起作用:

DROP TRIGGER IF EXISTS `bid_AFTER_INSERT` ;
DELIMITER |

CREATE DEFINER = CURRENT_USER TRIGGER `blah`.`bid_AFTER_INSERT` AFTER INSERT ON `bid` FOR EACH ROW
BEGIN

call sp_internal_bid_history_updation_on_bid_insert("bid","created_date",null,new.created_date,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","created_id",null,new.created_id,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","name",null,new.name,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","first_delivery",null,new.first_delivery,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","email",null,new.email,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","final_delivery",null,new.final_delivery,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","master_bid_id",null,new.final_delivery,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","partner_id",null,new.partner_id,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","orders_id",null,new.orders_id,new.id);
END

|
DELIMITER ;

出现以下错误:

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 `insightbasev2`.`bid_AFTER_INSERT` AFTER INSERT ON `bid`
FOR EACH ROW
BEGIN
call sp_internal_bid_history_updation_on_bid_insert("bid","created_date",null,new.created_date,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","created_id",null,new.created_id,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","name",null,new.name,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","first_delivery",null,new.first_delivery,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","email",null,new.email,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","final_delivery",null,new.final_delivery,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","master_bid_id",null,new.final_delivery,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","partner_id",null,new.partner_id,new.id);
call sp_internal_bid_history_updation_on_bid_insert("bid","orders_id",null,new.orders_id,new.id);
END
DELIMETER ;

只需尝试上面的代码。

我已经尝试过了,效果很好。

关于mysql - 触发器创建语句不起作用+分隔符错误+mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45183224/

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