0
我對Oracle 11使用TOAD,對SQL來說很新穎。我寫了一個proc,現在正在試圖測試和查看它的輸出。我寫了下面的塊:PLSQL查看sys_refcursor的輸出結果
DECLARE
cur_test SYS_REFCURSOR;
type t_row is record(psh_code varchar2(20) , pattr_end_date varchar2(20), pperf_gross varchar2(20));
r_test t_row;
BEGIN
procPerfTR(xxx-xxxx', 'xxxxxxx', 'xxxxxxx', 'xxxxxx', :cur_test);
LOOP
FETCH cur_test INTO r_test;
EXIT WHEN cur_test%NOTFOUND;
END LOOP;
CLOSE cur_test;
END;
/
但是,我上環行線以下錯誤
ORA-01001:無效光標
的錯誤是在第10行這是行上有 「LOOP」
我PROC看起來像這樣
CREATE OR REPLACE PROCEDURE procPerfTR
(
paramPortfCode VARCHAR2,
paramEndDate VARCHAR2,
paramShare VARCHAR2,
paramFreq VARCHAR2,
O_cursorPerf out SYS_REFCURSOR
)
IS
I_cursorPerf SYS_REFCURSOR;
BEGIN
OPEN I_cursorPerf FOR
SELECT PS.PSH_CODE, PP.PATTR_END_DATE, PP.PPERF_GROSS
FROM
PORTFOLIO_PERFORMANCES PP
INNER JOIN PORTF_SHARE PS ON PS.PORTF_SHARE_ID = PP.PORTF_SHARE_ID
INNER JOIN PORTFOLIO P ON P.PORTF_ID = PS.PORTF_ID
INNER JOIN T_FREQUENCY TF ON TF.FREQUENCY_ID = PP.FREQUENCY_ID
WHERE
P.PORTF_CODE = paramPortfCode
AND PP.PATTR_CALCUL_DATE = PP.PATTR_END_DATE
AND PP.PATTR_END_DATE = paramEndDate
AND TF.EXT_CODE = paramFreq
AND PS.PSH_CODE LIKE
(CASE
WHEN paramShare = 'xxxx' THEN '%xxx'
WHEN paramShare = 'xxxx' THEN '%xxx'
END);
O_cursorPerf:=I_cursorPerf;
END;
/
什麼是'procPerfTR'? – FrustratedWithFormsDesigner 2013-05-08 15:39:45
這是我打電話的過程。 – GreenyMcDuff 2013-05-08 15:52:11
這個錯誤會給你一個行號嗎?如果你提供了'procPerfTR'的內容,如果沒有太多的麻煩,它可能也會有所幫助。 – FrustratedWithFormsDesigner 2013-05-08 16:20:29