9 Replies Latest reply on Oct 15, 2013 9:56 AM by padders

    ref cursor

    Sarathy..beginner

      What is a ref cursor and how is the data fetched..



       

      this is my function :

       

      create or replace function get_dept(p_deptno in number) return sys_refcursor is

           v_rc sys_refcursor;

          begin

            open v_rc for select empno, ename, mgr, sal from emp where deptno = p_deptno;

            --sys.dbms_output.put_line(empno||ename||mgr||sal);

            return v_rc;

          end;

       

           execute:

      declare

      v_rc sys_refcursor;

      begin

      v_rc :=get_dept(10);

      end;

       

       

      i couldn't print the empno,ename,mgr,sal..so how could i print these things ..

       

       

      thanks&regards

      sarathy..