Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008
    Posts
    13

    Unanswered: accessing an OUT cursor from insde a procedure

    Hi,

    I have procedure sub_proc(input1,input2, out_cursor)
    where input1 and input2 are inputs passed to the procedure

    and out_cursor is an IN OUT mode SYS_REFCURSOR

    Now I need to call this sub_proc inside main_proc() and access the resultset that the cursor retrieves.


    Im unaware of how to access the cursor from main_proc.
    Searched on google but dint find anything that helped.

    Please let me know how to access it, or if at all we can access.


    Thanks in advance

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Like this example:

    Code:
    declare
       l_rc sys_refcursor;
       l_name varchar2(30);
       procedure test (p_rc in out sys_refcursor)
       is
       begin
          open p_rc for select ename from emp;
       end;
    begin
       test(l_rc);
       loop
          fetch l_rc into l_name;
          exit when l_rc%notfound;
          dbms_output.put_line(l_name);
       end loop;
    end;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •