Oracle PLSQL Demo - 20.弱类型REF游标[没有指定查询类型,也不指定返回类型]

时间:2023-03-09 04:34:30
Oracle PLSQL Demo - 20.弱类型REF游标[没有指定查询类型,也不指定返回类型]
declare

    Type ref_cur_variable IS REF cursor;
cur_variable ref_cur_variable; v_ename varchar2(10);
v_deptno number(2);
v_sal number(7,2); v_sql varchar2(100) := 'select t.ename, t.deptno, t.sal from scott.emp t'; begin Open cur_variable For v_sql; Loop
fetch cur_variable
InTo v_ename, v_deptno, v_sal;
Exit When cur_variable%NotFound;
dbms_output.put_line(cur_variable%rowcount || ' -> ' || v_ename ||
' ' || v_deptno || ' ' || v_sal);
End Loop;
Close cur_variable; end;