i have a procedure that give me a refcursor as out parameter and i have to join that data with other tables in my own package.
i try to fetch cursor in a variable of the same return type but get: PLS-00497: cannot mix between single row and multi-row (BULK) in INTO list
types defined in external package (i cannot alter it)
CURSOR CUR_MYTYPE IS SELECT f1... FROM xxx
TYPE MYTYPE IS REF_CURSOR RETURN CUR_MYTYPE%ROWTYPE
my own code:
result SCHEMA.MYTYPE;
cur sys_refcursor;
check VARCHAR2;
PKG.PROCEDURE_NAME(check,cur);
fetch cur bulk collect into result ;
select t.f1, t.f2, t.f3, o.f1, o.f2
from table(result ) t
inner join otherTable o
on o.f1 = t.f1
Are you sure you've got all that correct? You cannot bulk collect into "result" if result is defined as a refcursor, eg
I am going to assume it is more like this:
In any event, MYTYPE needs to be a nested table type (which it is not in the case above) so that you can run the TABLE() function around it. If that is not the case, then you could create your own local schema type which maps to the columns and then transfer the rows to that, eg