在delphi里面怎么取得oracle存储过程的返回集啊,兄弟现在只是调用存储过程成功,但不知道返回的结果集该怎么取,该用甚么控件可以直接取得结果集。
如下例:
--包头
CREATE OR REPLACE package pkg_test as
type myrctype is ref cursor;
function get(intID number) return myrctype;
end pkg_test;
--包体
CREATE OR REPLACE package body pkg_test as
function get(intID number) return myrctype
is
rc myrctype;
sqlstr varchar2(500);
begin
sqlstr := 'select begincode,endcode from Code';
open rc for sqlstr;
return rc;
end get;
end pkg_test;
--plsql测试代码
declare
w_rc pkg_test.myrctype;
w_begin Code.begincode%type;
w_end Code.endcode%type;
begin
w_rc := pkg_test.get(1);
loop
fetch w_rc into w_begin,w_end;
exit when w_rc%notfound;
dbms_output.put_line(w_begin);
dbms_output.put_line(w_end);
end loop;
end;
如下例:
--包头
CREATE OR REPLACE package pkg_test as
type myrctype is ref cursor;
function get(intID number) return myrctype;
end pkg_test;
--包体
CREATE OR REPLACE package body pkg_test as
function get(intID number) return myrctype
is
rc myrctype;
sqlstr varchar2(500);
begin
sqlstr := 'select begincode,endcode from Code';
open rc for sqlstr;
return rc;
end get;
end pkg_test;
--plsql测试代码
declare
w_rc pkg_test.myrctype;
w_begin Code.begincode%type;
w_end Code.endcode%type;
begin
w_rc := pkg_test.get(1);
loop
fetch w_rc into w_begin,w_end;
exit when w_rc%notfound;
dbms_output.put_line(w_begin);
dbms_output.put_line(w_end);
end loop;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货