沒有明顯的理由,我得到這個錯誤:蟾蜍PLSQL錯誤執行存儲過程
SELECT AMD.MSG_DATE
從以下存儲過程:
CREATE OR REPLACE PROCEDURE CTI_MATRIX.AMD_NEEDMSG (v_CRN IN VARCHAR2)
IS
return_flag INTEGER;
row_cnt INTEGER;
number_of_days INTEGER;
var_DATE DATE;
CURSOR ACCNTSEARCH (P_CRN IN VARCHAR2) IS
SELECT AMD.MSG_DATE
FROM TBL_AMD_NEEDMSG AMD
WHERE AMD.PHONE_NUMBER = P_CRN;
BEGIN
OPEN ACCNTSEARCH(v_CRN);
FETCH ACCNTSEARCH INTO var_DATE;
IF ACCNTSEARCH%NOTFOUND
THEN
row_cnt := 0;
ELSE
row_cnt :=1;
END IF;
CLOSE ACCNTSEARCH;
IF (row_cnt = 0)
THEN
INSERT INTO TBL_AMD_NEEDMSG (PHONE_NUMBER, MSG_DATE) VALUES (v_CRN , SYSDATE);
return_flag := 1;
ELSE
SELECT SYSDATE-var_DATE INTO number_of_days FROM dual;
IF (number_of_days>7)
THEN
UPDATE TBL_AMD_NEEDMSG SET MSG_DATE = SYSDATE WHERE PHONE_NUMBER = v_CRN;
return_flag := 1;
ELSE
return_flag := 0;
END IF;
END IF;
COMMIT;
dbms_output.put_line('result='||return_flag);
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
--raise_application_error(-20001,'An error was encountered '||SQLERRM);
END AMD_NEEDMSG;
/
ORA-00942: table or view does not exist
與調試光標線被設置
順便說一下,存儲過程通過以下調用塊調用:
DECLARE
V_CRN VARCHAR2(32767);
BEGIN
V_CRN := '5457648547567';
CTI_MATRIX.AMD_NEEDMSG (V_CRN);
DBMS_OUTPUT.Put_Line('');
COMMIT;
END;
絕對困惑,因爲表肯定存在並聲明如下:
SELECT AMD.MSG_DATE
FROM TBL_AMD_NEEDMSG AMD
WHERE AMD.PHONE_NUMBER = '85100000000';
獲取W/O問題記錄結果。
請幫忙。
也許錯誤不是由於你所在的具體行,而是一些查詢TOAD試圖執行?嘗試運行TOAD的SQL監視器或SQL跟蹤器並監視toad.exe。它會捕獲所有正在製作的SQL調用,也許你可以看到錯誤的來源。 – OldProgrammer