ITPub博客

首页 > 数据库 > Oracle > 【 Oracle 】- 复习而已

【 Oracle 】- 复习而已

Oracle 作者:jian_2009 时间:2013-12-08 14:25:09 0 删除 编辑

 

    就是又温习了下下:

    -- 援引游标(动态游标)
declare
-- 声明援引游标类型
 type type_cursor is ref cursor;
 v_cursor type_cursor;
 v_info v_cursor%rowtype;-- 动态游标中不能利用标名%rowtype
 begin
     open v_cursor for select dname from emp,dept;
   loop
    fetch v_cursor into v_info;
     exit when v_cursor%notfound;
       dbms_output.put_line(v_info.ename||v_info.dname);
   end loop;
   close v_cursor;
 end;
 -- 体系游标(援引游标)
declare
-- 声明援引游标类型
 v_cursor sys_refcursor;
 v_info varchar2(50);
 begin
     open v_cursor for select dname from emp,dept;
   loop
    fetch v_cursor into v_info;
     exit when v_cursor%notfound;
       dbms_output.put_line(v_info);
   end loop;
   close v_cursor;
 end;
 
 select * from emp ;
 
 


<!-- 正文结束 -->

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22945711/viewspace-1116215/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2009-11-29