提示错误 
 在创建‘create’在需要下列之一时 begin function package    pragma procedure subtype type use <an identifier>    <a double-quoted delimited-identifier> form current cursor --创建包
CREATE OR REPLACE package PKG_CUST_INVESTINCOME as
 /***********************************************************************************************
      类型名:  T_TERMINVERTCURSOR
     功    能:  定义了一个REF CURSOR
    日    期:  2012-02-20
  ***********************************************************************************************/
   type T_TERMINVERTCURSOR is REF CURSOR;
   /***********************************************************************************************
      过程名:    f_customer_investincome
      功能:      创建查询客户投机收益统计
      作者:       zfj
      日期:      2012-02-20
  ***********************************************************************************************/
   function f_customer_investincome (p_fundacco IN VARCHAR2,p_begindate IN VARCHAR2,p_enddate IN VARCHAR2) 
     return T_TERMINVERTCURSOR;
end PKG_CUST_INVESTINCOME;---创建包体
CREATE OR REPLACE PACKAGE BODY PKG_CUST_INVESTINCOME AS
--创建查询客户投机收益数据函数
create or replace function  f_customer_investincome(p_fundacco IN VARCHAR2,p_begindate IN VARCHAR2,p_enddate IN VARCHAR2)
RETURN T_TERMINVERTCURSOR IS
 cur  T_TERMINVERTCURSOR;
 v_begindate    varchar2(8) := '19001231';
 v_enddate      varchar2(8) := to_char(sysdate, 'YYYYMMDD');
 v_tablename    varchar2(40);
 v_sql          varchar2(32767):=null;  
begin
    --处理条件
   if v_begindate is not null and length(v_begindate) = 8 and
       isnumber(v_begindate) = 1 then
      v_begindate := p_begindate;
    end if;
    if p_enddate is not null and length(p_enddate) = 8 and
       isnumber(p_enddate) = 1 then
      v_enddate := p_enddate;
    end if; 
     -- 调用数据中心接口
    execute immediate 'begin pkgprofitanalyse6.sp_EntireIIRatio(:a,:b,:c,2); end;' using v_begindate,v_enddate,out v_tablename;
     --执行查询
  --  execute immediate 'select tic.c_fundacco , tc.c_custname,tc.c_custno,tc.C_MOBILENO,tc.C_PHONE from  '||v_tablename||' tic,tcustomerinfo tc where tic.c_custno = tc.c_custno   ';
    v_sql:='select tic.c_fundacco , tc.c_custname,tc.c_custno,tc.C_MOBILENO,tc.C_PHONE from  '||v_tablename||' tic,tcustomerinfo tc where tic.c_custno = tc.c_custno';
 open cur for v_sql;
 return cur;
end ;
end PKG_CUST_INVESTINCOME;
/

解决方案 »

  1.   

    CREATE OR REPLACE package PKG_CUST_INVESTINCOME as晕,一看你写的就是包体,你的包头呢,先了解下PACKAGE的结构和写法
      

  2.   

    CREATE OR REPLACE package PKG_CUST_INVESTINCOME as
     /***********************************************************************************************
      类型名: T_TERMINVERTCURSOR
      功 能: 定义了一个REF CURSOR
      日 期: 2012-02-20
      ***********************************************************************************************/
      type T_TERMINVERTCURSOR is REF CURSOR;
      /***********************************************************************************************
      过程名: f_customer_investincome
      功能: 创建查询客户投机收益统计
      作者: zfj
      日期: 2012-02-20
      ***********************************************************************************************/
      function f_customer_investincome (p_fundacco IN VARCHAR2,p_begindate IN VARCHAR2,p_enddate IN VARCHAR2)  
      return T_TERMINVERTCURSOR;
    end PKG_CUST_INVESTINCOME;
    ----是包头啊
      

  3.   

    搞定了 是在创建函数时 用的create or replace function f_customer_investincome
    改为function f_customer_investincome
    就行了