tags:

views:

635

answers:

0

create or replace function get_item_id ( p_folder_id LISTOFNUMBER_T
) return LISTOFNUMBER_T IS l_item_id LISTOFNUMBER_T; begin l_item_id LISTOFNUMBER_T := LISTOFNUMBER_T(); For i in p_folder_id.first..p_folder_id.last Loop select t.item_id
into l_item_id(i) from (select i.item_id,rownum as r from items i , job_info j where j.folder_id = p_folder_id(i) and i.job_info_id = j.job_info_id) t where t.r = i; End Loop; return l_item_id; end; This function was compiled successfully. To test/ run the above function, the following code was written DECLARE P_FOLDER_ID CA.LISTOFNUMBER_T; v_Return CA.LISTOFNUMBER_T; BEGIN -- Modify the code to initialize the variable --P_FOLDER_ID LISTOFNUMBER_T := LISTOFNUMBER_T(); P_FOLDER_ID := LISTOFNUMBER_T(1317);

v_Return := GET_ITEM_ID( P_FOLDER_ID => P_FOLDER_ID ); FOR i in v_Return.first..v_Return.last LOOP DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return(i)); END LOOP; END; Which gives me the errors "ORA-06531: Reference to uninitialized collection" at line 10