错误代码:1054未知列'数量'在'字段列表'

时间:2015-01-18 12:24:58

标签: mysql mysql-error-1054

我正在尝试在mysql中创建stored Procedure,它将值插入一个table并更新另一个table中的值。

但是我这样做会出现以下错误。

Error Code: 1054 Unknown column 'quantity' in 'field list'

请帮助。

提前完成。

以下是我的stored Procedure

DELIMITER $$

USE `billing`$$

DROP PROCEDURE IF EXISTS `createBill`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `createBill`(x_itemId       VARCHAR(400),x_ItemQnty INT(200),x_totalBill VARCHAR(400))
BEGIN

DECLARE p_bill_Id INT;
DECLARE p_item_qnty INT;

SET p_bill_Id=0;
SET p_item_qnty=0;
SET p_item_qnty = getItemQnty(x_itemId);
SET p_bill_Id=getBillid();

IF p_bill_Id IS NULL THEN
SET p_bill_Id=0;
END IF;

IF p_item_qnty >0 THEN

INSERT INTO bill_details (billId, itemId, itemQuantity, totalBill)
VALUES (p_bill_Id,x_itemId,x_ItemQnty,x_totalBill); 
SET p_item_qnty=p_item_qnty-1;
UPDATE billing.item_details SET item_details.item_quantity = p_item_qnty WHERE item_details.item_id = x_itemId;
SELECT CONCAT(x_itemId," added successfully") AS 'message';
ELSE 
SELECT CONCAT(x_itemId," is finsihed") AS 'message';
END IF;


END$$

DELIMITER ;

0 个答案:

没有答案