create语句,触发器不工作+分隔符错误+ mysql

时间:2017-07-19 07:06:38

标签: mysql triggers delimiter

以下触发器无效的创建语句:

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 ;

获取以下错误:

  

您的SQL语法有错误;检查手册   对应于您的MySQL服务器版本,以便使用正确的语法   在第1行'DELIMITER'附近

1 个答案:

答案 0 :(得分:0)

INSERT ... ON DUPLICATE KEY

试试上面的代码。

我曾经尝试过它并且它对我来说很好。