create or replace package types as
   type my_cursor is ref cursor;
end;
create or replace procedure proc_get_MLTInputData(startdate in date,enddate in date,
tempCursor out types.my_cursor)
as
begin
     if  startdate is not null and enddate is not null
     then
        open tempCursor for select UNITSINFONAME as company,productsname as product,
        createdate,nvl(CheckValues,READVALES) as value from RawMeteringChamber where 
        createdate>=startdate and createdate<=enddate;
     end if;
end;这个存储过程哪儿错了啊   怎么执行的啊    编译都通过了  Test 也没报错    执行就是报错  存储sql

解决方案 »

  1.   

    这种为什么不写成函数呢?返回my_cursor
    select func_name(date1,date2) from dual;
      

  2.   

    干嘛要写包,还自定义类型? 下面试试看
    create or replace function func_get_MLTInputData(startdate in date,enddate in date
    ) RETURN SYS_REFCURSOR AUTHID CURRENT_USER 
    as
    CUR    SYS_REFCURSOR;
    begin
         if  startdate is not null and enddate is not null
         then
            open CUR for select UNITSINFONAME as company,productsname as product,
            createdate,nvl(CheckValues,READVALES) as value from RawMeteringChamber where 
            createdate>=startdate and createdate<=enddate;
         end if;
     return CUR
    end;--调用函数,返回结果
    select func_get_MLTInputData(to_date('20121212','yyyymmdd'),to_date('20121212','yyyymmdd')) from dual;