I have a procedure that accepts an array of folder IDs and needs to return a list of document IDs. Folders are associated to documents in a one-to-many relationship--there are many documents for each folder. Specifically, there is a documents table which has a parent_folderid fk to the folders table.
This is what I have:
PROCEDURE get_folder_documents_ (
paa_folderids_i IN gtyp_folderids_table
) IS
lnt_temp_docids &&MATTER_SCHEMA..docid_tab := &&MATTER_SCHEMA..docid_tab();
lv_current_table_size NUMBER := gnt_documentids.COUNT;
BEGIN
FOR i IN paa_folderids_i.FIRST .. paa_folderids_i.LAST
LOOP
SELECT documentid
BULK COLLECT INTO lnt_temp_docids
FROM t$documents
WHERE parent_folderid = paa_folderids_i(i);
FOR j IN 1 .. lnt_temp_docids.COUNT
LOOP
lv_current_table_size := lv_current_table_size + 1;
gnt_documentids.EXTEND(1);
gnt_documentids(lv_current_table_size) := lnt_temp_docids(j);
END LOOP;
END LOOP;
END get_folder_documents_;
Is there a better way?