Oracle 11g: using cursors inside procedure.
Database
1
Posts
1
Posters
1
Views
1
Watching
-
I'm trying to return two ref cursors from a procedure and having a bit of trouble. What I'm trying to do is grab the info from the first cursor, select a few fields out of it and join to some other info and stick the result into a table variable... then select distinct items from that table into the second cursor. But I can't get this to compile. Can someone tell me what I'm doing wrong please? type T_CURSOR is REF CURSOR
procedure FetchSL3Details_PRC
(
c_items out T_CURSOR,
c_identifiers out T_CURSOR,
p_niin in char
) as
v_idents IDENTIFIER_TABLE_TYPE:= IDENTIFIER_TABLE_TYPE();
BEGINopen c\_items for select its.item\_set\_id, its.niin, its.parent\_niin, its.commodity\_id, its.service\_type, its.sl3\_type, its.qty, its.created\_id, its.created\_dt, its.modified\_id, its.modified\_dt from item\_set its start with its.niin = p\_niin connect by prior its.niin = its.parent\_niin; for item in c\_items loop v\_idents.extend; v\_idents(v\_idents.LAST) := identifier\_row\_type(item.commodity\_id, get\_group\_name\_fun(item.commodity\_id), 0); v\_idents.extend; v\_idents(v\_idents.LAST) := identifier\_row\_type(item.created\_id, get\_formatted\_name\_fun(item.created\_id), 0); v\_idents.extend; v\_idents(v\_idents.LAST) := identifier\_row\_type(item.modified\_id, get\_formatted\_name\_fun(item.modified\_id), 0); end loop; open c\_identifiers for select distinct(v.id), v.name, v.type from v\_idents v;
END FetchSL3Details_PRC;