码迷,mamicode.com
首页 > 数据库 > 详细

Oracle PLSQL Demo - 17.游标查询个别字段(非整表)

时间:2015-06-30 00:05:02      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:

declare

    Type ref_cur_variable IS REF cursor;
    cur_variable ref_cur_variable;
    v_empno scott.emp.empno%type;
    v_ename scott.emp.ename%type;

    v_sql varchar2(100) := select t.empno, t.ename from scott.emp t;

begin

    Open cur_variable For v_sql;
    
    Loop
        fetch cur_variable
            InTo v_empno, v_ename;
        Exit When cur_variable%NotFound;
        dbms_output.put_line(cur_variable%rowcount ||  ->  || v_empno ||
                                 || v_ename);
    End Loop;
    Close cur_variable;

end;

 

Oracle PLSQL Demo - 17.游标查询个别字段(非整表)

标签:

原文地址:http://www.cnblogs.com/nick-huang/p/4609104.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!