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

oracle 游标使用(显式游标)

时间:2014-07-13 00:35:28      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   数据   os   

1.  

Set Serveroutput on;  

declare 
    Cursor tem_cursor is 
           select * from xuesheng xs;
           v_row tem_cursor%rowtype;
begin 
    open tem_cursor;
    loop
         fetch tem_cursor into v_row;
         exit when tem_cursor%NOTFOUND;
         dbms_output.put_line(v_row.xing_ming);
    end loop;
    close tem_cursor;
end;
/

2.

set serveroutput on;
declare
    cursor tmp_cur is
           select xing_ming,yu_wen,shu_xue from xuesheng;
           v_xing_ming xuesheng.xing_ming%type;
           v_yu_wen xuesheng.yu_wen%type;
           v_shu_xue xuesheng.shu_xue%type;
begin
    open tmp_cur;
    loop
         fetch tmp_cur into v_xing_ming,
                            v_yu_wen,
                            v_shu_xue;
         exit when tmp_cur%NOTFOUND;
         dbms_output.put_line(v_xing_ming);
    end loop;
    close tmp_cur;
end;
/

 3.

set serveroutput on;
declare
    cursor tem_cur is
           select xs.xing_ming,xs.yu_wen,xs.shu_xue 
           from xuesheng xs;
begin
    for tem_xs in tem_cur 
    loop
        dbms_output.put_line(tem_xs.xing_ming);
    end loop;
end;
/

 

数据库前面的章节中有。(不喜勿喷哦)

oracle 游标使用(显式游标),布布扣,bubuko.com

oracle 游标使用(显式游标)

标签:style   blog   color   使用   数据   os   

原文地址:http://www.cnblogs.com/mrgong/p/3838233.html

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