declare Type ref_cur_variable IS REF cursor; cur_variable ref_cur_variable; rec_emp scott.emp%RowType; v_sql varchar2(100) := 'select * from scott.emp t'; begin Open cur_variable For v_sql; Loop fetch cur_variable InTo rec_emp; Exit When cur_variable%NotFound; dbms_output.put_line(cur_variable%rowcount || ' -> ' || rec_emp.empno || ' ' || rec_emp.sal); End Loop; Close cur_variable; end;