注册

创建存储存储过程的时候报错:“警告:创建的对象带有编译错误”

DM_654250 2021/05/21 1992 4 已解决

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:dm8
【操作系统】:windows2012r2
【CPU】:inter®Xeon Cpu E5-2680 v3 @2.50GHz
【问题描述】:
创建存储过程的时候报错:“警告:创建的对象带有编译错误”,请问怎么查看详情错误信息,能定位好行号和列号吗?
具体代码如下:



create or replace package PAK_001 is  type t_cursor is ref cursor;  
procedure GetDataByPage(     p_tableName varchar2,     p_fields varchar2,     p_filter varchar2,     
p_sort varchar2,     p_curPage number,     p_pageSize number,     p_cursor out t_cursor,     p_totalRecords out number          );
end PAK_001;

create or replace package body PAK_001 is

 procedure Proc_Pagination(
     p_tableName varchar2,--要查询的表名
     p_fields varchar2,--要查询的字段
     p_filter varchar2,--过滤条件
     p_sort varchar2,--排序字段及方向
     p_curPage number,
     p_pageSize number,
     p_cursor out t_cursor,
     p_totalRecords out number        
 )
 is
     v_sql varchar2(2000):='';
     v_startRecord number(4);
     v_endRecord number(4);
begin
  --获取总的记录数
  v_sql:='select to_number(count(*)) from '||p_tableName;
  if p_filter is not null then
    v_sql:=v_sql||' where 1=1 and '||p_filter;
  end if;
  execute immediate v_sql into p_totalRecords;
  
  v_startRecord:=(p_curPage-1)*p_pageSize;
  v_endRecord:=p_curPage*p_pageSize;
  
  v_sql:='select '||p_fields||' from (select '||p_fields||',rownum r from '||
         '(select '||p_fields||' from '||p_tableName;
  if p_filter is not null then
    v_sql:=v_sql||' where 1=1 and '||p_filter;
  end if;
  if p_sort is not null then
    v_sql:=v_sql||' order by '||p_sort;
  end if;
  v_sql:=v_sql||') A where rownum<='||to_char(v_endRecord)||') B where r>='||to_char(v_startRecord);
  open p_cursor for v_sql;
  
 end Proc_Pagination;     
   
end PAK_001;



回答 0
暂无回答
扫一扫
联系客服