ORA-01403 是由过程接收的还是在过程中调用的包?
Is ORA-01403 being received by the procedure or the package being called within the procedure?
抱歉粘贴长代码。我有一个在 table 中插入数据并调用多个包的过程。在 运行 以下过程中,出现以下错误 -
现在我知道错误出现在调用程序包 PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY
的第 3 阶段。我的问题是 -
是否因为没有数据调用而抛出ORA 01403PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY
?
抛出 ORA 01403,因为 PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY
被调用但未返回任何内容。
代码:
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
这意味着 PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY
function/procedure 可能有 SELECT 没有 return 任何数据的查询:
SELECT Id into MyVariable
From Table1
Where 1=0
上面的查询给出了 NO_DATA_FOUND 错误,因为没有可以分配给 MyVariable 的 ID。
如果您仔细查看您的错误,错误会给出错误发生的确切行,以便您可以检查错误 SQL.
抱歉粘贴长代码。我有一个在 table 中插入数据并调用多个包的过程。在 运行 以下过程中,出现以下错误 -
现在我知道错误出现在调用程序包 PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY
的第 3 阶段。我的问题是 -
是否因为没有数据调用而抛出ORA 01403
PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY
?抛出 ORA 01403,因为
PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY
被调用但未返回任何内容。
代码:
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
这意味着 PKG_CM_ACTIONS.P_NEW_CASE_NOTIFY
function/procedure 可能有 SELECT 没有 return 任何数据的查询:
SELECT Id into MyVariable
From Table1
Where 1=0
上面的查询给出了 NO_DATA_FOUND 错误,因为没有可以分配给 MyVariable 的 ID。
如果您仔细查看您的错误,错误会给出错误发生的确切行,以便您可以检查错误 SQL.