Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Oracle 11g: using cursors inside procedure.

Oracle 11g: using cursors inside procedure.

Scheduled Pinned Locked Moved Database
oraclequestion
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    USAFHokie80
    wrote on last edited by
    #1

    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();
    BEGIN

    open 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;

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups