CREATE OR REPLACE PROCEDURE SALE (OUTLETID IN NUMBER,
itemCod IN NUMBER,
START_Date IN DATE,
END_DATE IN DATE,
OUTLETID1 OUT NUMBER,
itemCod1 OUT NUMBER,
AMOUNT OUT NUMBER,
Quantity OUT NUMBER,
Entry_Date OUT DATE)
IS
BEGIN
SELECT l.OUTLET_ID,
itemCode,
SUM (Amount) Amount,
SUM (quantity) Quantity,
i.Entry_Date
INTO OUTLETID1,
itemCod1,
AMOUNT,
Quantity,
Entry_Date
FROM IDSTRANSACTION i
JOIN lup_outlet l ON l.OUTLET_ID = i.outlet_id
JOIN LUP Z ON Z.ZONE_ID = L.ZONE_ID
JOIN prod p ON p.serial = itemCode
JOIN lup_master m ON m.sup_id = p.Supplier_ID
WHERE l.OUTLET_ID IN (OUTLETID)
AND itemCode IN (itemCod)
AND TO_DATE (i.Entry_Date) BETWEEN START_Date AND END_DATE
GROUP BY l.OUTLET_ID, itemCode, i.Entry_Date;
END;
DECLARE
var NUMBER;
var1 NUMBER;
var2 NUMBER;
var3 NUMBER;
BEGIN
SALE_PROCEDURE (OUTLETID => 809,
itemCod => 128169,
START_Date => DATE '2018-01-01',
end_Date => DATE '2019-01-01',
AMOUNT => var,
Quantity => var1,
OUTLETID1 => var2,
itemCod1 => var3);
DBMS_OUTPUT.enable;
DBMS_OUTPUT.put_line (var);
DBMS_OUTPUT.enable;
DBMS_OUTPUT.put_line (var1);
DBMS_OUTPUT.enable;
DBMS_OUTPUT.put_line (var2);
DBMS_OUTPUT.enable;
DBMS_OUTPUT.put_line (var3);
END;
答案 0 :(得分:2)
该过程需要5个OUT参数。
调用它时,您提供了4个变量。缺少entry_date
(DATE
数据类型)的最后一个。那可能是
var4 DATE;