12 Replies Latest reply on Jul 24, 2013 4:04 PM by nagarw31

    Getting error ORA-06512:

    user8511747

      Hi,

       

      When i was running below code getting error, Please suggest solution.

       

      [code]

       

      create or replace

      function get_dept_emps(p_deptno in number) return sys_refcursor is

            v_rc sys_refcursor;

          begin

            open v_rc for 'select  EMPLOYEE_ID, FIRST_NAME, SALARY, DEPARTMENT_ID from employees where department_id = :deptno' using p_deptno;

           return v_rc;

          end;

       

       

      declare

      v_ref sys_refcursor;

       

       

      --type typ is table of ref cursor;

      --v_ref  typ;

      v_eid number;

      v_fname varchar2(50);

      v_sal number;

      v_did number;

      begin

      v_ref := GET_DEPT_EMPS(100);

      --open v_ref;

      fetch v_ref into v_eid,v_fname,v_ref,v_sal;

       

       

      --dbms_output.put_line(v_eid||v_fname||v_sal||v_did);

      close v_ref;

       

       

      end;

       

      [code]

       

      Thanks,

      brij