0

表:WSH_DEL_DETAILS_INTERFACE

唯一列:DELIVERY_DETAIL_INTERFACE_ID

程序输入:DELIVERY_DETAIL_INTERFACE_ID

要获取的列值:SALES_ORDER_LINE_NUMBERSALES_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;
4

1 回答 1

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;

您的光标正在返回表中的所有记录,因为您将表的列本身等同起来,而不是将其与过程中的输入变量匹配

于 2018-12-26T14:16:47.687 回答