该过程接收到ORA-01403还是该过程中调用了包?

时间:2018-12-17 22:15:45

标签: sql oracle stored-procedures no-data ora-01403

很抱歉粘贴长代码。我有一个将数据插入表中并调用多个程序包的过程。在运行以下过程时,出现以下错误-

ORA-01403

现在,我知道错误发生在阶段3,在该阶段正在调用软件包PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY。我的问题是-

  1. 是否由于没有数据可调用PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY而抛出ORA 01403?

  2. 由于PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY被调用但未返回任何内容而引发了ORA 01403。

代码:

create or replace PROCEDURE P_BNS_CREATE_CASE_MNUL
    IS
    L_CASE_INTRL_ID         VARCHAR2(15);
    L_STAGE                 NUMBER;
    L_ERROR_CODE            NUMBER;
    L_ERROR_MSG             VARCHAR2(4000);

  TYPE R_PARAMS IS RECORD (
        CUSTOMER_ID        VARCHAR2(50),
        CUSTOMER_TYPE      VARCHAR2(50),
        SCORE_CT           NUMBER(6),
        PRIORITY_CD        VARCHAR2(20),
        JRSDCN_DESC        VARCHAR2(50),
        CASE_TITL_NM       VARCHAR2(200),
        CASE_TYPE_CD       VARCHAR2(20),
        CASE_SUBTYPE_CD    VARCHAR2(20),
        OWNER_ID           NUMBER(10), 
        ASSIGNED_TO_ID     NUMBER(10),
        SYSTEM_ID          NUMBER(10)
    );

    TYPE T_PARAMS IS TABLE OF R_PARAMS INDEX BY PLS_INTEGER;
    L_PARAMS T_PARAMS;

    BEGIN
    L_STAGE := 1;

    SELECT CUSTOMER_ID, t3.CODE_VAL, SCORE_CT, PRIORITY_CD, t2.JRSDCN_CD, CASE_TITL_NM, CASE_TYPE_CD, CASE_SUBTYPE_CD, T5.OWNER_SEQ_ID, T6.OWNER_SEQ_ID, T7.OWNER_SEQ_ID
    BULK COLLECT INTO L_PARAMS
    FROM TB_BNS_CREATE_CASE_MNUL t1 LEFT JOIN KDD_JRSDCN t2 
        ON upper(t1.JRSDCN_DESC) = upper(t2.JRSDCN_DESC_TX)
    LEFT JOIN   KDD_CODE_SET_TRNLN t3
        ON upper(t1.CUSTOMER_TYPE) = upper(t3.CODE_DISP_TX) AND t3.CODE_SET = 'CustomerType'
    LEFT JOIN KDD_REVIEW_OWNER t5
        ON upper(t1.OWNER_ID) = upper(t5.OWNER_DSPLY_NM)
    LEFT JOIN KDD_REVIEW_OWNER t6
        ON upper(t1.ASSIGNED_TO_ID) = upper(t6.OWNER_DSPLY_NM)
    LEFT JOIN KDD_REVIEW_OWNER t7
        ON upper(t7.OWNER_ID) = 'SYSTEM'   
    WHERE CASE_INTRL_ID IS NULL;

    FOR INDX IN 1 .. L_PARAMS.COUNT LOOP

    L_STAGE := 1.1;
    SELECT PARAM_VALUE_TX||CM_CASES_SEQ.NEXTVAL INTO L_CASE_INTRL_ID  
    FROM KDD_INSTALL_PARAM WHERE PARAM_ID=17; /*this statement also returns results */

    L_STAGE := 2;

    INSERT INTO KDD_CASES (ID,NAME,...) VALUES (....,...,....);     

    L_STAGE := 3;
    PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY(L_CASE_INTRL_ID, 'SYSTEM', '0', L_PARAMS(INDX).SCORE_CT, L_PARAMS(INDX).CUSTOMER_ID, 'a', L_PARAMS(INDX).CASE_SUBTYPE_CD);

    L_STAGE := 4;
    PKG_CM_TABS.P_KYC_MANUAL_CASE_INS(L_CASE_INTRL_ID, L_PARAMS(INDX).CUSTOMER_ID, L_PARAMS(INDX).SCORE_CT);

    L_STAGE := 5;
    PKG_CM_TABS.P_UPDATE_CASE_DUEDT('CA9', L_CASE_INTRL_ID);

    L_STAGE := 6;
    UPDATE TB_BNS_CREATE_CASE_MNUL
    SET CASE_INTRL_ID = L_CASE_INTRL_ID
    WHERE CUSTOMER_ID = L_PARAMS(INDX).CUSTOMER_ID AND CASE_TYPE_CD = L_PARAMS(INDX).CASE_TYPE_CD;

    END LOOP;

    --COMMIT;
    EXCEPTION
        WHEN OTHERS THEN
            ROLLBACK;
            L_ERROR_CODE := SQLCODE;
            L_ERROR_MSG  := SQLERRM;
            DBMS_OUTPUT.PUT_LINE (L_ERROR_CODE||' - Error occured at stage -'||L_STAGE||' - '||L_ERROR_MSG);   
    END P_BNS_CREATE_CASE_MNUL;


  [1]: https://i.stack.imgur.com/Lde3j.png

1 个答案:

答案 0 :(得分:2)

这意味着PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY函数/过程可能具有不返回任何数据的SELECT查询:

SELECT Id into MyVariable
From Table1
Where 1=0

上面的查询给出了NO_DATA_FOUND错误,因为没有可以分配给MyVariable的ID。

如果您仔细查看错误,该错误会给出错误发生的确切行,以便您可以检查错误的SQL。