oracle 存储过程游标学习
2013-12-04 10:11
423 查看
使用游标的5个步骤
1、声明一些变量用于保存select语句返回的指
2、声明游标,并指定select 语句
3、打开游标
4、从游标中获取记录
5、关闭游标
从游标中获取每一条记录可使用fetch语句。fetch语句将列的指读取到指定的变量中;
语法:
例子:
备注:为了确定循环是否结束,可以使用布尔变量temp_cursor%notfound。当fetch达到游标中最后一条记录,不能再读取更多记录的时候,这个变量就为真。
1、声明一些变量用于保存select语句返回的指
2、声明游标,并指定select 语句
3、打开游标
4、从游标中获取记录
5、关闭游标
从游标中获取每一条记录可使用fetch语句。fetch语句将列的指读取到指定的变量中;
语法:
fetch cursor_name into variable[, variable ...];
例子:
create or replace procedure sel_person is v_id person.id%type; v_name person.pname%type; v_birthday person.birthday%type; cursor temp_cursor is select * from person; begin open temp_cursor; loop fetch temp_cursor into v_id,v_name,v_birthday; exit when temp_cursor%notfound; dbms_output.put_line(v_id||'----'||v_name||'----'||v_birthday); end loop; close temp_cursor; end sel_person;
备注:为了确定循环是否结束,可以使用布尔变量temp_cursor%notfound。当fetch达到游标中最后一条记录,不能再读取更多记录的时候,这个变量就为真。
相关文章推荐
- Oracle编程学习存储过程、函数、游标
- oracle 最简单的学习笔记,增删改查,PLSQL基本语法,游标,函数,存储过程的实现
- Oracle 的存储过程及游标(又学习)
- JDBC连接Oracle代码案列操作之--Oracle存储过程数据集返回(游标)
- oracle之存储过程,临时表,游标示例
- oracle 存储过程(其中使用了游标)例子
- Oracle 存储过程学习
- oracle的学习六:pl/sql基础(数据类型、定义变量)、游标、过程、函数、包、触发器(系统触发器)
- oracle 存储过程和函数学习笔记
- ORACLE 存储过程动态游标例子
- oracle学习总结5(游标、触发器、过程、方法)
- 主题:Oracle存储过程学习
- oracle存储过程中 使用游标做循环封装数据集
- oracle 游标,函数 function , 存储过程 PROCEDURE , 触发器 Trigger
- Oracle存储过程学习 (转)
- oracle 在一个存储过程中调用另一个返回游标的存储过程
- Oracle存储过程中如何使用游标
- 【学习】java下实现调用oracle的存储过程和函数
- oracle在存储过程里面调用其它的存储过程(包含游标)
- oracle 存储过程的学习