您的位置:首页 > 数据库 > Oracle

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

2015-06-29 23:06 507 查看
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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: