I have set up an Oracle Package with a procedure similar to the code below. I had to set up a couple of globals first:
CREATE
OR REPLACE type cr_list_type AS object
(
flag VARCHAR2(1));
CREATE
OR REPLACE type t_cr_list
IS
TABLE OF cr_list_type;
I also define a type in the package header:
type flagTableType is table of varchar2(1) index by binary_integer;
I then created a proc as follows:
PROCEDURE get_stuff
(
o_results OUT SYS_REFCURSOR,
o_files out sys_refcursor,
in_list IN flagTableType
)
IS
v_flag_list t_cr_list;
BEGIN
v_flag_list := t_cr_list();
v_flag_list.extend(in_list.count);
for i in in_list.first .. in_list.last
loop
v_flag_list(i) := cr_states_type(in_list(i));
end loop;
OPEN o_results FOR
select MyID, MyData
FROM MyTable
where MyFlag IN (SELECT flag from TABLE(v_flag_list));
open o_files for
select * from MyTableFiles a
where a.MyID in (select MyID
from MyTable
where MyFlag in (SELECT flag from TABLE(v_flag_list))
);
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL; -- Normal result
end get_stuff;
In the end, when i run it, i get a error occurred at recursive SQL level 1 error followed by a no statement parsed error.
I'm not using recursive queries. I know it's in the array, since if i remove the "in (SELECT flag from TABLE(v_flag_list))" from the second cursor and go with a "= 'X'", then both cursors return values. If i remove the second cursor query altogether, the array works fine on the first cursor. This has me flummoxed!