René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Cursor for nested cursors

create or replace function func_sys_refcursor (
  rc in sys_refcursor
) return number as

  v_a number;
  v_b varchar2(10);

  v_ret number := 0;

begin

  loop
    fetch rc into v_a, v_b;
    exit when rc%notfound;

    v_ret := length(v_b) * v_a + v_ret;
  end loop;

  return v_ret;
end;
/

select
    func_sys_refcursor(
      cursor (
        select * from table_ref_cursor
      )
    )
from dual;