oracle 游标实例
2015-08-14 09:41
477 查看
create or replace procedure test
as
CURSOR cursor_test IS select 5 from dual
union all select 6 from dual
union all select 7 from dual
union all select 8 from dual
union all select 9 from dual;
p_pm1 number;
p_pm2 number;
begin
--打开游标
open cursor_test;
LOOP
fetch cursor_test into p_pm1;
exit when cursor_test%notfound;
select p_pm1 into p_pm2 from dual;
end loop;
--关闭游标
close cursor_test;
--提交
commit;
exception
when others then
rollback;
end test;
as
CURSOR cursor_test IS select 5 from dual
union all select 6 from dual
union all select 7 from dual
union all select 8 from dual
union all select 9 from dual;
p_pm1 number;
p_pm2 number;
begin
--打开游标
open cursor_test;
LOOP
fetch cursor_test into p_pm1;
exit when cursor_test%notfound;
select p_pm1 into p_pm2 from dual;
end loop;
--关闭游标
close cursor_test;
--提交
commit;
exception
when others then
rollback;
end test;
相关文章推荐
- oracle查看写法效率
- 64位系统使用32位的plsql连接64位的Oracle 11g
- Oracle物化视图的一般使用
- Oracle中TO_DATE格式数据按年月日汇总
- oracle 数据库技术支持生命周期表
- 免安装Oracle连接数据库(odbc驱动)
- Oracle索引扫描
- Oracle_绑定变量窥探测试
- 客户端如何访问访问oracle 12c 64位的数据库
- Oracle 11g 导库导不出空表问题
- Oracle数据库优化策略总结篇
- 简析Oracle数据库常见问题及解决方案
- 无法远程访问虚拟机中的EM (Oracle Enterprise Manager)
- Oracle 学习之RAC(七) 集群启动解析
- linux 之静默安装oracle
- Oracle 11gR2 List-Range分区实验
- oracle count 百万级 分页查询记录总数、总条数优化
- 说说oracle的 sysdate、trunc函数
- linux 之静默安装oracle
- ORACLE分页查询SQL语法