在代码中执行 CREATE PROC 时,我一直在 MYSQL(5.2 版)中遇到语法错误,这让我感到困惑。
MySQL Proc 代码:
DELIMITER //
CREATE PROCEDURE Delete_BillOfMaterialsDetail
(IN InOrderDate DATE,
IN InProductCode varchar(40),
IN InRawMaterialProductCode varchar(40)
)
BEGIN
IF EXISTS
(SELECT * FROM basf_rawmaterialplanning.BillOfMaterialsDetail
WHERE OrderDate = InOrderDate
and ProductCode = InProductCode
and RawMaterialProductCode = InRawMaterialProductCode)
THEN
DELETE FROM basf_rawmaterialplanning.BillOfMaterialsDetail
WHERE OrderDate = InOrderDate
AND ProductCode = InProductCode
AND RawMaterialProductCode = InRawMaterialProductCode;
END IF;
END //
DELIMITER ;
我使用字符串数据类型构建它,然后针对给出语法错误的数据库执行它。
我不确定我做错了什么?
- 谢谢伙计们,我想通了,将发布答案,以便 StackOverflow 允许我