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
原文地址:http://www.cnblogs.com/mrgong/p/3838233.html