create package pk_Test as 
  t_cur is ref cursor ;
  function fn_getResult(tablename varchar2) return t_cur;
end pk_test;
/
create  package body pk_Test as
 function fn_getResult(tablename varchar2) return cursor
  is rs t_Cur;
 begin
   open rs for ' select * from ' || tablename ;
   return rs;
   exception 
     when others then 
       rasie;
 end fn_getResult;
end pk_test;
/

解决方案 »

  1.   


    but  I have a problem for that how to close the cursor   how to close the rs ?
      

  2.   

    我是说在Delphi里,怎么设置才能调用。
    你写的那个是用函数返回游标,我用过程返回是一个效果吧?
    我想请你指点在Delphi里怎么调用你写的函数来返回一个数据集?
      

  3.   

    我是说在Delphi里,怎么设置才能调用。
    你写的那个是用函数返回游标,与我用过程返回是一个效果吧?
    我想请你指点在Delphi里怎么调用你写的函数来返回一个数据集?
      

  4.   

    too easy ,  you can use  TADOStoreProcedure 
      like othe database component , set property , i think ...
      

  5.   

    用Delphi的TADOStoreProcedure连接Oracle的存储过程会出错,
    用TADOQuery或Query能够连接,但不能返回像Sql-Server中的结果集>
    我想再问一下Oralce中的过程或函数能不能返回数据集?
      

  6.   

    用Delphi的TADOStoreProcedure连接Oracle的存储过程可以执行,我已经用了几次了,只是我的存储过程是在三层中的中间层写的,而且我并没有返回一个数据集
    ,你可以将放回的数据定义称多维数组,返回
    调用如下:
        adspRunYtj.Parameters.ParamByName('ny').Value:=NY;
        adspRunYtj.Parameters.ParamByName('SRETURN').Value:=sRFlag;
        adspRunYtj.ExecProc;
    adspRunYtj是TADOStoreProcedure
    设置它的procedurename 和需要传入、传出的参数类型
      

  7.   

    procedure p_CLOSE(
    p_dd in out t_cursor)
    is
    begin
      IF P_DD%ISOPEN THEN
        CLOSE p_dd;
      END IF;
    end;
    end;
      

  8.   

    ORACLE 不能返回数据集 
    :)BUG