0
我已經創建了自定義Oracle記錄類型,我試圖填充一些值並嘗試訪問另一個存儲過程中的相同內容(實際上我將從Java - 我也在Java中得到相同的錯誤),但我得到了「超出計數的下標」錯誤消息。無法將數據添加到Oracle自定義記錄 - 錯誤 - 超出計數的下標
我只是一個初學者存儲過程。 以下是我所做的。
Oracle客戶記錄類型
create or replace type learnerMapCustomRecord as object(activityName varchar2(20),activityDescn varchar2(20));
create or replace type learnerMapCustomRecordTable as table of learnerMapCustomRecord;
存儲過程來填充值,記錄類型
create or replace PROCEDURE getLearnerMapDetails(learnerMapCustomRecord out learnerMapCustomRecordTable) as
cursor c1 is select object_name,status from user_objects where rownum <= 2;
c c1%rowtype;
i number:=1;
begin
learnerMapCustomRecord := learnerMapCustomRecordTable();
open c1;
loop
fetch c1 into c;
EXIT WHEN C1%NOTFOUND;
dbms_output.put_line(c.object_name||'==>'||c.status);
-- learnerMapCustomRecord.extend;
learnerMapCustomRecord(I).activityName:=C.OBJECT_NAME;
learnerMapCustomRecord(i).activityDescn:=c.status;
i:=i+1;
end loop;
end;
從那裏我調用上面的SP訪問自定義記錄類型的列表存儲過程。
create or replace procedure data_collection_extract as
learnerMapCustomRecord learnerMapCustomRecordTable;
begin
getLearnerMapDetails(learnerMapCustomRecord);
for i in learnerMapCustomRecord.first..learnerMapCustomRecord.last
LOOP
dbms_output.put_line(learnerMapCustomRecord(i).activityName||'==>'||learnerMapCustomRecord(i).activityDescn);
end loop;
end;
set serveroutput on;
exec data_collection_extract();
/
show error;
Error report -
ORA-06533: Subscript beyond count
ORA-06512: at "FOL_DEV.GETLEARNERMAPDETAILS", line 13
ORA-06512: at "FOL_DEV.DATA_COLLECTION_EXTRACT", line 4
ORA-06512: at line 1
06533. 00000 - "Subscript beyond count"
*Cause: An in-limit subscript was greater than the count of a varray
or too large for a nested table.
*Action: Check the program logic and explicitly extend if necessary.
你能解釋我做錯了什麼嗎?
你的'CURSOR'返回[超過2147483647行](http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/collections.htm#LNPLS00512)?因爲它是嵌套表可容納的最大值。 – 2014-11-05 18:28:52