在用c#调用oracle包下的存储过程时报错,并且是有时是好的,有时报错,郁闷中,请教各位高手:
报错误如下:
ORA-00997:非法使用long数据类型oracle包主题如下:create or replace package body Package_Pagination is
  --*******************************************************
  PROCEDURE PROC_Pagination
  (  
  Pindex in number, --分页索引 
  Psql in varchar2, --产生dataset的sql语句
  Psize in number, --页面大小
  RecordsCount out number, --返回总的记录行数
  Pcount out number, --返回分页总数
  v_cur out type_cursor --返回当前页数据记录集
  )
  AS
  v_sql VARCHAR2(1000);
  v_count number; 
  v_Plow number;
  v_Phei number;
  Begin  
  v_sql := 'select count(*) from (' || Psql || ')';
  execute immediate v_sql into v_count;
  -----------------------------------------取总的记录行数
  RecordsCount:=v_count;
  -----------------------------------------取分页总数
  Pcount := ceil(v_count/Psize);
  --------------------------------------------显示任意页内容
  v_Phei := Pindex * Psize + Psize;
  v_Plow := v_Phei - Psize + 1;    
  v_sql :='select * from (select rownum rnm, a.* from ('||Psql ||') a where rownum <='|| v_Phei||' ) where rnm >='|| v_Plow ;
  open v_cur for v_sql;
  End PROC_Pagination;
  --*******************************************************  
end Package_Pagination;
c#调用时传入的参数是:
Pindex=0
Psql=select a.a0 id,a.a2 title,a.a3 source,Fun_get_content(b.a1) content from well05 a,well05a b where a.a0=b.a0 and a.a2 like '%经济%' and rownum<100
Psize=10
 

解决方案 »

  1.   

    Fun_get_content的作用是根据编码得到文本内容并截取前200个字符作为返回直,文本内容的字段类型为long类型.
    create or replace function Fun_get_content --截取新闻内容表的内容字段
    (
    n_newid in well05.a0%type  --新闻编号

    return varchar2 is
      s_content long; --新闻内容     
    begin
      select a1 into s_content from well05a where a0=n_newid;  
      s_content:=replace(s_content,'chr(13)','<BR>');
      s_content:=replace(s_content,' ','&nbsp;');   
      s_content:=replace(s_content,')','');
      s_content:=rtrim(ltrim(s_content));
      s_content:=substr(s_content,1,200);  
      s_content:=s_content||'......';
      return(s_content);
    exception
    when no_data_found then
      return null;
    when others then
      return null;
    end Fun_get_content;是不是这里不能用long类型啊?