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