兄弟你找对人了 给你个例子: 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; / 在delphi中调用时(这里使用oracle oledb/ odbc做为接口),除了要设置扩展属性为PLSQLRSET=1外: 1.用adoquery时语句应该写为query.sql.text:='{call mypk.func()}';其中'()'可以省略; 2.用adostoredproc时procedurename='mypk.func';
oracle 中临时表的建立和一般的表基本相同 create global temporary table temp (id int) on commit preserve rows; 引用时可以使用select * from temp;如果有其它问题mailto:[email protected],我最近很少上网.
给你个例子:
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;
/
在delphi中调用时(这里使用oracle oledb/ odbc做为接口),除了要设置扩展属性为PLSQLRSET=1外:
1.用adoquery时语句应该写为query.sql.text:='{call mypk.func()}';其中'()'可以省略;
2.用adostoredproc时procedurename='mypk.func';
create global temporary table temp (id int) on commit preserve rows;
引用时可以使用select * from temp;如果有其它问题mailto:[email protected],我最近很少上网.