PLS-00323子程序或光标' CPQ_DATA_HANDLE ___'在包规范中声明,必须在包体

时间:2015-09-25 13:19:30

标签: oracle plsql

当我添加新程序时,我似乎无法执行我的包体。

任何人都可以告诉我我缺少的东西,例如参考包等。

我正在努力想知道我哪里出错了。

提前感谢您的帮助。

封装

    CREATE OR REPLACE PACKAGE TEST.CPQ_QUOTE_DATA_API IS



 FUNCTION Check_Exist___ (
PROJECT_ID_ IN VARCHAR2,
SUB_PROJECT_ IN VARCHAR2,
ACTIVITY_ID_ IN VARCHAR2,
ORDER_NO_ IN VARCHAR2,
PART_NO_ IN VARCHAR2) RETURN BOOLEAN;

    PROCEDURE CPQ_DATA_HANDLE___ ( 
    PROJECT_ID_ IN VARCHAR2,
    SUB_PROJECT_ IN VARCHAR2,
    ACTIVITY_ID_ IN VARCHAR2,
    ORDER_NO_ IN VARCHAR2,
    PART_NO_ IN VARCHAR2,
    QTY_ IN NUMBER,
    PRICE_COST_ IN NUMBER,
    GPARTCOST_ IN NUMBER,
    CPQ_DATE_ IN VARCHAR2,
    DATECREATED_ IN VARCHAR2);

END CPQ_QUOTE_DATA_API;

包裹体

CREATE OR REPLACE PACKAGE BODY TEST.CPQ_QUOTE_DATA_API IS

FUNCTION Check_Exist___ (
    PROJECT_ID_ IN VARCHAR2,
    SUB_PROJECT_ IN VARCHAR2,
    ACTIVITY_ID_ IN VARCHAR2,
    ORDER_NO_ IN VARCHAR2,
    PART_NO_ IN VARCHAR2) RETURN BOOLEAN
    IS
       dummy_ NUMBER;
       CURSOR exist_control IS
          SELECT 1
          FROM   CPQ_QUOTE_DATA_TAB
          WHERE PROJECT_ID_ = PROJECT_ID
          AND SUB_PROJECT_ = SUB_PROJECT
          AND ACTIVITY_ID_ = ACTIVITY_ID
          AND ORDER_NO_ = ORDER_NO
          AND PART_NO_ = PART_NO;
    BEGIN
       OPEN exist_control;
       FETCH exist_control INTO dummy_;
       IF (exist_control%FOUND) THEN
          CLOSE exist_control;
          RETURN(TRUE);
       END IF;
       CLOSE exist_control;
       RETURN(FALSE);
    END Check_Exist___;

PROCEDURE CPQ_DATA_HANDLE___  

as
   PROJECT_ID_    VARCHAR2(10 CHAR);
  SUB_PROJECT_   VARCHAR2(10 CHAR);
  ACTIVITY_ID_  VARCHAR2(10 CHAR);
  ORDER_NO_     VARCHAR2(12 CHAR);
  PART_NO_      VARCHAR2(25 CHAR);
  QTY_          NUMBER;
  PRICE_COST_    NUMBER;
  GPARTCOST_    NUMBER;
  CPQ_DATE_     VARCHAR2(50 CHAR);
  DATECREATED_  VARCHAR2(50 CHAR);

   CURSOR get_record IS 
      SELECT *
        FROM TEST.WTS_CPQ_DATA_TRANS_TAB; 

GetRec get_record%ROWTYPE;

BEGIN 

open get_record;
loop
fetch get_record into GetRec;

exit when get_record%NOTFOUND;

  PROJECT_ID_        :=  GetRec.PROJECT_ID; 
  SUB_PROJECT_       :=  GetRec.SUB_PROJECT;
  ACTIVITY_ID_       :=  GetRec.ACTIVITY_ID;
  ORDER_NO_          :=  GetRec.ORDER_NO;
  PART_NO_           :=  GetRec.PART_NO;
  QTY_               :=  GetRec.QTY; 
  PRICE_COST_        :=  GetRec.PRICE_COST;
  GPARTCOST_         :=  GetRec.GPARTCOST;
  CPQ_DATE_          :=  GetRec.CPQ_DATE;
  DATECREATED_      :=  GetRec.DATECREATED;

IF TEST.CPQ_QUOTE_DATA_API.CHECK_EXIST___(PROJECT_ID_, SUB_PROJECT_, ACTIVITY_ID_, ORDER_NO_, PART_NO_) = TRUE 

THEN 

insert into TEST.WTS_CPQ_ERROR_DATA

(PROJECT_ID,SUB_PROJECT,ACTIVITY_ID,ORDER_NO,PART_NO,QTY,PRICE_COST,GPARTCOST,CPQ_DATE,DATE_CREATED) 

VALUES

(PROJECT_ID_,SUB_PROJECT_,ACTIVITY_ID_,ORDER_NO_,PART_NO_,QTY_,PRICE_COST_,GPARTCOST_,CPQ_DATE_,DATECREATED_) 
;
COMMIT;

ELSE 

insert into TEST.CPQ_QUOTE_DATA_TAB

(PROJECT_ID,SUB_PROJECT,ACTIVITY_ID,ORDER_NO,PART_NO,QTY,PRICE_COST,GPARTCOST,CPQ_DATE,DATE_CREATED) 

VALUES

(PROJECT_ID_,SUB_PROJECT_,ACTIVITY_ID_,ORDER_NO_,PART_NO_,QTY_,PRICE_COST_,GPARTCOST_,CPQ_DATE_,DATECREATED_) 
;
COMMIT;

END IF;


  END LOOP; 
close get_record;
END CPQ_DATA_HANDLE___;

END CPQ_QUOTE_DATA_API;

1 个答案:

答案 0 :(得分:1)

您的过程没有参数,而是在主体中有局部变量。因此,实现与声明不同,两者被视为两个不同的过程。

PROCEDURE CPQ_DATA_HANDLE___ 
as
  PROJECT_ID_    VARCHAR2(10 CHAR);
  SUB_PROJECT_   VARCHAR2(10 CHAR);
  ...

应该是

PROCEDURE CPQ_DATA_HANDLE___ (
  PROJECT_ID_    VARCHAR2,
  SUB_PROJECT_   VARCHAR2,
  ...
as