我试图将一个过程从使用 sql plus 转换为 mysql,但在第三行出现语法错误,它显示 (W_IN IN NUMBER) 并且它突出显示为语法错误。
SQL加:
CREATE OR REPLACE PROCEDURE PRC_CUS_BALANCE_UPDATE (W_IN IN NUMBER) AS
W_CUS NUMBER := 0;
W_TOT NUMBER := 0;
BEGIN
-- GET THE CUS_CODE
SELECT CUS_CODE INTO W_CUS
FROM INVOICE
WHERE INVOICE.INV_NUMBER = W_IN;
-- UPDATES CUSTOMER IF W_CUS > 0
IF W_CUS > 0 THEN
UPDATE CUSTOMER
SET CUS_BALANCE = CUS_BALANCE +
(SELECT INV_TOTAL FROM INVOICE WHERE INV_NUMBER = W_IN)
WHERE CUS_CODE = W_CUS;
END IF;
END;
mysql:
-- Trigger DDL Statements
DELIMITER $$
CREATE PROCEDURE prc_cus_balance_update (W_IN IN NUMBER)
AS
W_CUS NUMBER = 0;
W_TOT NUMBER = 0;
BEGIN
-- GET CUS_CODE
SELECT CUS_CODE INTO W_CUS
FROM INVOICE
WHERE INVOICE.INV_NUMBER = W_IN;
-- UPDATES CUSTOMER IF W_CUS > 0
IF W_CUS > 0 THEN
UPDATE CUSTOMER
SET CUS_BALANCE = CUS_BALANCE +
(SELECT INV_TOTAL FROM INVOICE WHERE INV_NUMBER = W_IN)
WHERE CUS_CODE = W_CUS;
END IF;
END $$
DELIMITER ;
任何帮助是极大的赞赏!