Я пытаюсь преобразовать процедуру из использования sql plus в mysql, но получаю синтаксическую ошибку в третьей строке, где он говорит (W_IN IN NUMBER), и он имеет IN, выделенную как синтаксическая ошибка.
SQL Plus:
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 ;
Любая помощь очень ценится!