DELIMITER $$
CREATE
PROCEDURE `cheque_alert`.`SavePoData`(IN poNo VARCHAR(25),IN releaseOrderDate DATE,IN expiryDate DATE,IN enteredDateTime DATETIME,IN enteredBy VARCHAR(8) ,
IN poItemCode VARCHAR(25),IN poItemsId CHAR(1),IN poItemDescription VARCHAR(75),IN quantity DOUBLE,IN amount DOUBLE
)
BEGIN
SELECT CASE WHEN ((SELECT 1 FROM `cheque_alert`.`po_main` WHERE po_no=poNo)>0)
THEN
INSERT INTO `cheque_alert`.`po_items_details`
(`pomainid_id`,
`po_item_code`,
`po_items_id`,
`po_item_description`,
`quantity`,
`amount`)
VALUES ((SELECT id FROM `cheque_alert`.`po_main` WHERE po_no =poNo),
poItemCode,poItemsId,poItemDescription,quantity,amount)
ELSE
INSERT INTO `cheque_alert`.`po_main`
(`po_no`,
`release_order_date`,
`expiry_date`,
`entered_date_time`,
`entered_by`)
VALUES (poNo,releaseOrderDate,expiryDate,enteredDateTime,(SELECT ID FROM cheque_alert.user_login WHERE USER_ID=enteredBy));
INSERT INTO `cheque_alert`.`po_items_details`
(`pomainid_id`,
`po_item_code`,
`po_items_id`,
`po_item_description`,
`quantity`,
`amount`)
VALUES ((SELECT LAST_INSERT_ID(),
poItemCode,
poItemsId,
poItemDescription,
quantity,
amount);
END;
END$$
DELIMITER ;
产生错误:
错误代码:1064
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取在 'INTO 附近使用的正确语法
cheque_alert
。po_items_details
(pomainid_id
, `po_item_cod' 在第 14 行
请让我知道我犯的错误?