oracle 在一个存储过程中调用另一个返回游标的存储过程
来源:互联网 发布:debian centos 编辑:程序博客网 时间:2024/05/21 10:08
实际项目当中经常需要在一个存储过程中调用另一个存储过程返回的游标,本文列举了两种情况讲述具体的操作方法。
第一种情况:返回的游标是某个具体的表或视图的数据
create or replace procedure p_testa(presult out sys_refcursor) asbegin open presult for select * from users;end p_testa;其中 users 就是数据库中一个表(或视图)。在调用的时候只要声明一个该表的rowtype类型就可以了:
create or replace procedure p_testb as temp_cur sys_refcursor; r users%rowtype;begin p_testa(temp_cur); loop fetch temp_cur into r; exit when temp_cur%notfound; dbms_output.put_line(r.name); end loop;end p_testb;
第二种情况:我们返回的不是表的所有的列,或许只是其中一列或两列
create or replace procedure p_testa(presult out sys_refcursor) asbegin open presult for select id, name from users;end p_testa;这里我们只返回了 users 表的 id, name 这两个列,那么调用的时候也必须做相应的修改:
create or replace procedure p_testb as temp_cur sys_refcursor; cursor cur_1 is select id, name from users where rownum = 1; r cur_1%rowtype;begin p_testa(temp_cur); loop fetch temp_cur into r; exit when temp_cur%notfound; dbms_output.put_line(r.id); end loop;end p_testb;
- oracle 在一个存储过程中调用另一个返回游标的存储过程
- oracle 在一个存储过程中调用另一个返回游标的存储过程
- oracle 在一个存储过程中调用另一个返回游标的存储过程
- 在一个存储过程中调用返回一个游标的另一个存储过程
- jdbc中调用oracle 返回游标类型的存储过程
- jdbc中调用oracle 返回游标类型的存储过程
- 在MSSQL中一个存储过程调用另一个存储过程
- vb调用oracle数据库返回游标的存储过程
- VBA调用带游标返回值的ORACLE存储过程
- java通过prepareCall调用oracle返回游标的存储过程
- 如何在oracle存储过程中返回游标
- 如何在oracle存储过程中返回游标----例子一
- 如何在oracle存储过程中返回游标----例子二
- 如何在oracle存储过程中返回游标
- 如何在oracle存储过程中返回游标
- Oracle Package中存储过程返回游标
- del调用返回游标的存储过程
- 在一个存储过程A中调用另外一个存储过程B返回的结果集
- ASP.NET 首页性能的十大做法
- 给csdn提一个bug
- Sql plus命令报command not found的解决笔记
- 闲谈StringBuilder
- 找工作中常见的PHP面试题及答案(2)
- oracle 在一个存储过程中调用另一个返回游标的存储过程
- C#遍历ComboBox
- ORA-12519: TNS:no appropriate service handler found 解决
- Error: ShouldNotReachHere() [整理]
- SPUtility
- 在XCODE中开发Iphone/Ipad 使用sqlite的Data Core框架.
- 郁闷的时候偷着乐
- 对象序列化
- Shell技巧:提示行魔术