Mysql删除触发器没有OLD行

时间:2014-12-23 17:25:58

标签: mysql triggers

我想在删除触发后创建,问题是MySql向我显示错误: Error Code: 1054. Unknown column 'attribtue_id' in 'OLD',但我有这样的排。现在我不知道出了什么问题。

DROP TRIGGER IF EXISTS delete_price;

DELIMITER $$
CREATE TRIGGER delete_price AFTER DELETE ON catalog_product_entity_decimal
  FOR EACH ROW
    BEGIN
      DECLARE normal_pr decimal(12,4);
      SET @special_pr_attribute_id := 76;
      SET @normal_pr_attribute_id := 75;

      IF (OLD.attribtue_id = @special_pr_attribute_id) THEN
        SET normal_pr := (select `value` from catalog_product_entity_decimal where entity_id=OLD.entity_id AND attribute_id=@normal_pr_attribute_id);
        UPDATE catalog_product_index_price SET price=normal_pr, final_price=normal_pr,min_price=normal_pr,max_price=normal_pr where entity_id=OLD.entity_id;
      ELSEIF (old.attribtue_id = @normal_pr_attribute_id) THEN
        DELETE FROM catalog_product_index_price where entity_id=OLD.entity_id;
      END IF;
    END $$
DELIMITER ;

1 个答案:

答案 0 :(得分:1)

Try:        attribute_id   
Instead of: attribtue_id