获取错误Error(8,1):PLS-00103:遇到符号“ /”
在包定义末尾尝试插入/符号会给出错误-Error(9,1):PLS-00103:遇到符号“ CREATE” 我想要的是在CreateShipment中进行验证,并将结果存储在验证数组中,并将数组传递给过程2,在该过程中我将进行插入
create or replace package WSH_Delivery_Detail_Shipment as
type Result IS VARRAY(8) OF INTEGER;
PROCEDURE CreateShipment(p_delivery_detail_interface_id IN WSH_DEL_DETAILS_INTERFACE.DELIVERY_DETAIL_INTERFACE_ID%TYPE,p_status OUT String) ;
PROCEDURE CreateShipmentLines(v_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)
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;
type Result IS VARRAY(8) OF INTEGER;
v_result result:=result();
l_uniqueRecords INTEGER;
l_organizationId INTEGER;
l_actionType INTEGER;
l_orderType INTEGER;
l_customerNumber INTEGER;
l_orderQuantity INTEGER;
l_orderquantityUom INTEGER;
l_updateAction INTEGER;
orgId INTEGER;
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;
BEGIN
select Organization_Id INTO l_organizationId from inv_org_parameters where Organization_Code=wddi_record.Organization_Code;
EXCEPTION
WHEN no_data_found THEN
l_organizationId:=0;
END;
IF (l_organizationId > 0) then
orgId:=l_organizationId;
l_organizationId:=1;
END IF;
/*validaion1 : Check for uniqueness of record with Organization_Code,Organization_Code,Organization_Id,SalesOrderNumber,SalesOrderLineNumber as unique */
SELECT COUNT(*) INTO l_uniqueRecords FROM WSH_DELIVERY_DETAILS WHERE SALES_ORDER_NUMBER=wddi_record.SALES_ORDER_NUMBER AND SALES_ORDER_LINE_NUMBER=wddi_record.SALES_ORDER_LINE_NUMBER
AND Organization_Id=orgId;
/*Validation3 : Check ActionType should be either CREATE, UPDATE, CANCEL */
IF (wddi_record.Line_Action_Type = 'CREATE' or wddi_record.Line_Action_Type = 'UPDATE' or wddi_record.Line_Action_Type = 'CANCEL') THEN
l_actionType:=1;
ELSE
l_actionType:=0;
END IF;
/* validation 4: Check OrderType should be a valid Order Type Lookup*/
select COUNT(1) INTO l_orderType from fnd_lookups where Lookup_Code = wddi_record.Source_Line_Type AND lookup_type='ORA_WSH_ORDER_LINE_TYPE';
/*Validation5 : CustomerNumber should be a valid Party Number based on OrderType*/
select COUNT(1) INTO l_customerNumber from HZ_PARTIES where Party_id=wddi_record.Ship_To_Party_Id;
/*Validation6 : OrderQuantity should be greater than 0 when ActionType is CREATE. When ActionType is UPDATE then OrderQuantity 0 is treated as CANCEL*/
IF(wddi_record.Line_Action_Type = 'CREATE' and wddi_record.SRC_REQUESTED_QUANTITY IS NULL or wddi_record.SRC_REQUESTED_QUANTITY <= 0 ) THEN
l_orderQuantity:=0;
else
l_orderQuantity:=1;
END IF;
/*Validation7 : OrderQuantityUOM should be a valid UOM Code in Units of Measure table*/
select COUNT(1) INTO l_orderquantityUom from inv_units_of_measure where UOM_CODE=wddi_record.SRC_REQUESTED_QUANTITY_UOM;
/*Validation8 : UPDATE action is allowed when Shipment Line Released Status is not Shipped or Interfaced.
RELEASED_STATUS != R
*/
select COUNT(1) INTO l_updateAction from WSH_DELIVERY_DETAILS where wddi_record.Line_Action_Type = 'UPDATE' AND SALES_ORDER_NUMBER=wddi_record.SALES_ORDER_NUMBER AND SALES_ORDER_LINE_NUMBER=wddi_record.SALES_ORDER_LINE_NUMBER
AND source_shipment_number=wddi_record.Source_Shipment_Number
AND source_shipment_id=wddi_record.Source_Shipment_Id
AND Organization_Id=orgId
AND RELEASED_STATUS != 'R';
/*1 - Pass
0-Fail
*/
v_result:=result(l_uniqueRecords,l_organizationId,l_actionType,l_orderType,l_customerNumber,l_orderQuantity,l_orderquantityUom,l_updateAction);
/*PROCEDURE CreateShipmentLines(v_result);*/
FOR i in 1.. 8 LOOP
DBMS_OUTPUT.PUT_LINE(v_result(i));
END LOOP;
END LOOP;
CLOSE wddi_cur;
END CreateShipment;
/*create or replace procedure CreateShipmentLines(v_result IN res)
END CreateShipmentLines;*/
END WSH_Delivery_
Detail_Shipment;
答案 0 :(得分:0)
根据我之前发布的评论:
尽管不是真正的“答案”,但我正在发布代码,该代码实际上是编译并显示应如何执行。代替NULL过程的主体,在其中放置您自己的代码。逐步进行,请经常进行测试。
SQL> CREATE TABLE wsh_del_details_interface(
2 delivery_detail_interface_id NUMBER
3 );
Table created.
SQL> CREATE OR REPLACE PACKAGE wsh_delivery_detail_shipment AS
2 TYPE result IS
3 VARRAY(8)OF INTEGER;
4 PROCEDURE createshipment(
5 p_delivery_detail_interface_id IN wsh_del_details_interface.delivery_detail_interface_id%TYPE,
6 p_status OUT STRING
7 );
8
9 PROCEDURE createshipmentlines(
10 v_result IN result
11 );
12 END wsh_delivery_detail_shipment;
13 /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY wsh_delivery_detail_shipment AS
2 PROCEDURE createshipment(
3 p_delivery_detail_interface_id IN wsh_del_details_interface.delivery_detail_interface_id%TYPE,
4 p_status OUT STRING
5 )
6 AS
7 BEGIN
8 NULL;
9 END;
10
11 PROCEDURE createshipmentlines(
12 v_result IN result
13 )
14 AS
15 BEGIN
16 NULL;
17 END;
18 END wsh_delivery_detail_shipment;
19 /
Package body created.
SQL>