请教高手,下面存储过程有什么错。plsql里面就是过不去。。紧急求助。。。。在线等

美丽大道 2012-04-20 09:49:17
2个select的 语句 单独拿出来调试 都没错。。放入存储过程就过不去。不知道是不是游标什么的写法不对。本人新手,请高手指点。谢谢。

create or replace procedure UP_GetDBDataOfMonth(QK in varchar2,JH in varchar2,starttime In
varchar2,endtime in varchar2,cur_out Out sys_refcursor)
as
begin
if JH is not null then
open cur_out for
select t.ms as th011a,t.Qo as th015a,t.Qw as th016a,t.Ql as th017a,sum(t.Qo)over(ORDER BY t.ms) as th013a,sum(t.Qw)over(ORDER BY t.ms) as th012a,sum(t.Ql)over(ORDER BY t.ms) as th014a,round(decode(t.Ql,0,0,t.Qw/t.Ql),4) as th019a,round(decode(t.Qo,0,0,t.Qw/t.Qo),4) as th020a,round(decode(t.Qo,0,0,t.Ql/t.Qo),4) as th022a from
(select NY as ms,sum(COALESCE(HSYCSL+HSYCYL,0)) as Ql,sum(COALESCE(HSYCYL,0)) as Qo,sum(COALESCE(HSYCSL,0)) as Qw from ydcl.yd_dba04@KF_DBLINK WHERE NY between to_char(to_date(starttime,'yyyy-mm-dd'),'yyyymm') and to_char(to_date(endtime,'yyyy-mm-dd'),'yyyymm') And jh IN (SELECT * FROM TABLE(CAST(split(JH,',') AS mytable))) group by NY ORDER BY ms) t;
else
open cur_out for
select t.ms as th011a,t.Qo as th015a,t.Qw as th016a,t.Ql as th017a,sum(t.Qo)over(ORDER BY t.ms) as th013a,sum(t.Qw)over(ORDER BY t.ms) as th012a,sum(t.Ql)over(ORDER BY t.ms) as th014a,round(decode(t.Ql,0,0,t.Qw/t.Ql),4) as th019a,round(decode(t.Qo,0,0,t.Qw/t.Qo),4) as th020a,round(decode(t.Qo,0,0,t.Ql/t.Qo),4) as th022a from (select NY as ms,sum(COALESCE(HSYCSL+HSYCYL,0)) as Ql,sum(COALESCE(HSYCYL,0)) as Qo,sum(COALESCE(HSYCSL,0)) as Qw from ydcl.yd_dbb01@KF_DBLINK WHERE NY between to_char(to_date(starttime,'yyyy-mm-dd'),'yyyymm') and to_char(to_date(endtime,'yyyy-mm-dd'),'yyyymm') And SCGS IN
(SELECT * FROM TABLE(CAST(split(QK,',') AS mytable))) group by NY ORDER BY ms) t;
end if;
end;
...全文
60 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧