表:WSH_DEL_DETAILS_INTERFACE
唯一列:DELIVERY_DETAIL_INTERFACE_ID
输入到过程:DELIVERY_DETAIL_INTERFACE_ID
要获取的列值: SALES_ORDER_LINE_NUMBER , SALES_ORDER_NUMBER
预期输出: 单条记录
实际输出: 表中的所有记录都已获取
代码:
create or replace PROCEDURE procedurevalidation(
delivery_detail_interface_id IN
WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,
ROW_COUNT OUT INTEGER)
IS
CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE
DELIVERY_DETAIL_INTERFACE_ID = delivery_detail_interface_id;
wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;
BEGIN
OPEN wddi_cur;
LOOP
FETCH wddi_cur into wddi_record;
EXIT when wddi_cur%NOTFOUND;
DBMS_OUTPUT.ENABLE(100000);
DBMS_OUTPUT.PUT_LINE(delivery_detail_interface_id);
DBMS_OUTPUT.PUT_LINE('SALESORDERNUMBER111:::: ' ||
wddi_record.SALES_ORDER_NUMBER);
DBMS_OUTPUT.PUT_LINE('SALESORDERLINENUMBER1111::::: ' ||
wddi_record.SALES_ORDER_LINE_NUMBER);
DBMS_OUTPUT.PUT_LINE('COUNT' || ROW_COUNT);
END LOOP;
CLOSE wddi_cur;
end;
答案 0 :(得分:2)
您需要将输入变量的名称更改为您的过程。
create or replace PROCEDURE procedurevalidation(
p_delivery_detail_interface_id IN
WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,
ROW_COUNT OUT INTEGER)
在光标中,您还需要更改变量名称。
CURSOR wddi_cur
IS
SELECT *
FROM WSH_DEL_DETAILS_INTERFACE
WHERE DELIVERY_DETAIL_INTERFACE_ID = p_delivery_detail_interface_id;
您的游标正在返回表中的所有记录,因为您要使表的列本身相等,并且不将其与过程中的输入变量匹配