使用Insert调用另一个过程(DML命令)

时间:2019-01-03 10:42:53

标签: plsql plsqldeveloper plsql-package

使用插入查询(同一包)调用另一个过程。 步骤2的参数化以数组作为操作输入

尝试的方法: 1-exec CreateShipmentLines(p_result);

2-CreateShipmentLines(p_result);

成功编译,但记录未插入表中。

CREATE or REPLACE package WSH_Delivery_Detail_Shipment is

type Result IS VARRAY(8) OF INTEGER;
p_result Result:=Result();

PROCEDURE CreateShipment(p_delivery_detail_interface_id IN 
WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT 
String);
PROCEDURE CreateShipmentLines(p_result IN RESULT);

END WSH_Delivery_Detail_Shipment;
/


CREATE OR REPLACE package body WSH_Delivery_Detail_Shipment as

PROCEDURE CreateShipment(p_delivery_detail_interface_id IN 
WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT 
String)

IS

CURSOR wddi_cur IS SELECT * FROM WSH_DEL_DETAILS_INTERFACE WHERE 
DELIVERY_DETAIL_INTERFACE_ID=p_delivery_detail_interface_id;
wddi_record WSH_DEL_DETAILS_INTERFACE%ROWTYPE;

p_result Result:=Result(1,1,1,1,1,1,1,1);

BEGIN

OPEN wddi_cur;

LOOP

FETCH wddi_cur into wddi_record;/* Validation2 : Check if Organization Id 
exists and store Organization_Id corresponding to Organization_Code*/
EXIT when wddi_cur%NOTFOUND;

>>>>>CODE>>>>>

CreateShipmentLines(p_result); // Calling Procedure 2 for insertion



END LOOP;
CLOSE wddi_cur;
END CreateShipment;

procedure CreateShipmentLines(p_result IN RESULT)

is

BEGIN

INSERT INTO WSH_DELIVERY .......
COMMIT;

END CreateShipmentLines;
END WSH_Delivery_Detail_Shipment;
/

0 个答案:

没有答案