在delphi中调用结果集的办法

create or replace package mypk
as
type t_cursor is ref cursor;
function func(a number) return t_cursor;
procedure proc(name varchar2,c out t_cursor,a number);
end;
/

create or replace package body mypk
as
function func(a number) return t_cursor
as
v_temp t_cursor;
begin
open v_temp for select * from test where id=a;
return v_temp;
end func;
procedure proc(name varchar2,c out t_cursor,a number)
as
begin
open c for select * from test where id=a and name=name;
end proc;
end;
/
注意:ref cursor一定要在包中以type声明,因为无法直接在func或proc中声明ref cursor类型.

在delphi中调用时,除了要设置扩展属性为PLSQLRSET=1外:
1.用adoquery时语句应该写为query.sql.text:='{call mypk.func()}';其中'()'可以省略;
2.用adostoredproc时procedurename='mypk.func';
3.使用存储过程返回结果集时在text中应该填入'{call mypk.proc(?,?)}',注意参数个数是除光标类型外的个数,顺序是除光标类型外的变量次序.
4.对于过程或函数调用的写法只能是'{call func/proc(?,?)}';
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值