oracle游标的例子
2014-04-30 00:00
441 查看
摘要: oracle
-------------
-----------------
-------------
--动态游标
建议你百度.google吧
declare cursor ca is select id_no, name from user where ym=201401; begin for cb in ca loop update path set ename=cb.name where id_no=cb.id_no; end loop; commit; end;
-------------
declare --游标结构 cursor ca is select * from emp where deptno = 10; --游标变量 carec ca%rowtype; begin
-----------------
declare --游标结构 cursor ca is select * from emp where deptno = 10; --游标变量 onerow ca%rowtype; begin --打开游标 open ca; loop fetch ca into onerow; exit when ca%notfound; dbms_output.put_line(onerow.ename); end loop; close ca; end;
-------------
declare cursor ca(dno emp.deptno%type) is select * from emp where deptno = dno; carec ca%rowtype; begin for carec in ca(10) loop dbms_output.put_line(carec.ename); end loop; end;
--动态游标
declare --动态游标数据类型 type cur is ref cursor; --游标结构变量 mycur cur; --行变量 cdept dept%rowtype; cemp emp%rowtype; begin --动态游标绑定select * form dept; open mycur for select * from dept; loop fetch mycur into cdept; exit when mycur%notfound; dbms_output.put_line(cdept.dname); end loop; dbms_output.put_line('--------------------------------'); open mycur for select * from emp; loop fetch mycur into cemp; exit when mycur%notfound; dbms_output.put_line(cemp.ename); end loop; close mycur; end;
建议你百度.google吧
相关文章推荐
- 利用游标返回结果集的的例子(Oracle 存储过程)JAVA调用方法和.NET调用方法
- Oracle利用游标返回结果集的的例子(C#)...(最爱)
- oracle开发中的存储过程,游标,if判断经典例子
- oracle 游标例子不同的 打开方式 -判断最后一条记录
- oracle 游标 返回结果集 例子
- 利用游标返回结果集的的例子(Oracle 存储过程)
- 21. oracle游标循环例子
- ORACLE 存储过程动态游标例子
- Oracle游标例子
- ORACLE 存储过程动态游标例子
- Oracle 游标的例子(待完善)
- Oracle的几个例子(删除表,游标等)
- oracle游标循环例子
- oracle更新大量数据太慢,可以通过游标实现的例子
- oracle的游标和例子
- oracle的游标和例子!
- Oracle显式游标小例子
- oracle开发中的存储过程,游标,if判断经典例子
- oracle 存储过程(其中使用了游标)例子
- Oracle显式游标小例子