-1
我創建了一個臨時表和一個存儲函數來讀取它。當我打電話給下面的消息出現:Oracle存儲函數與臨時表
RA-22905: Zugriff auf Zeilen eines Objekts, das keine Nested Table ist, nicht möglich
22905. 00000 - "cannot access rows from a non-nested table item"
*Cause: attempt to access rows of an item whose type is not known at
parse time or that is not of a nested table type
*Action: use CAST to cast the item to a nested table type
Fehler in Zeile: 3 Spalte: 15
那麼,我該怎麼做CAST的事呢?
我心愛的功能:
create or replace PACKAGE BODY testlho2 IS
FUNCTION getBasicDate (app_in IN varchar2, termc_in IN varchar2)
return sys_refcursor is
l_rc SYS_REFCURSOR;
BEGIN
-- Populate temporary table
INSERT INTO temp_tab_test_lho2 (app, sla, tsl)
SELECT app, sla, tslstat
FROM pmon_orig_file
WHERE app = app_in and termcause = termc_in;
-- Open REF CURSOR for Output
open l_rc for
select app, sla, tsl
from temp_tab_test_lho2;
return l_rc;
END;
END testlho2 ;
[ORA-22905 - quering SELECT語句的表類型時]的可能重複(http://stackoverflow.com/questions/19208264/ ora-22905-when-quering-a-table-type-with-a-select-statement) –
對不起,我的晶球失靈了。如果你發佈你的功能,也許有人會說如何修復它。 –
創建或替換PACKAGE BODY testlho2 IS FUNCTION getBasicDate(app_in IN varchar2,termc_in IN varchar2)return sys_refcursor is l_rc SYS_REFCURSOR; BEGIN ( - 填充臨時表) INSERT INTO temp_tab_test_lho2 (應用程序,SLA,TSL) SELECT應用,SLA,tslstat FROM pmon_orig_file WHERE應用程式= app_in \t和termcause = termc_in; ( - 打開REF CURSOR輸出) 打開l_rc 選擇應用程序,sla,tsl from temp_tab_test_lho2; return l_rc; END; END testlho2; – user