ORA-06502: PL/SQL: 数字或值错误 : 字符串缓冲区太小解决办法

异常脚本:
select row_number() over(ORDER BY SYDW,jldw,FYLY) xh,
SYDW,
jldw,
FYLY,
wm_concat(ddxdms) ddxdms,
wm_concat(ypbhs) ypbhs,
sum(SDWCSL) SDWCSL,
sum(BQJSSL) BQJSSL,
sum(BQWCSL) BQWCSL,
TO_CHAR(sum(JSSL) / sum(BQWCSL)*100,‘FM99990.00’) jsbfl ,
TO_CHAR(sum(WCSL) / sum(YJYWCDGSL)*100,‘FM99990.00’) jsbfl
from (
select f.jldw,
SDWCSL,
a.FYLY,
b.ddxdms,
b.ypbhs,
BQJSSL,
BQWCSL,
LJWCSL,
a.SYDW,
YJYWCDGSL
from (select ddxdm, XM, yp, fy, RWDBH,SYDW, decode(count(ypbh),null,0,count(ypbh)) WCSL
from (select ddxdm, XM, ypph, fy, RWDBH, SYDW,ypbh
from Tickdetail
where fbbs =‘1’
and FYLY !=‘0’
and FBRQ between to_date(‘2019-1-1’,‘yyyy-mm-dd’) and
to_date(‘2020-5-1’,‘yyyy-mm-dd’)
group by ddxdm, XM, yp, fy, RWDBH,SYDW, ypbh)
group by ddxdm, XM, yp, fy,SYDW, RWDBH) a,

     (select xm, yp, fy, RWDBH,SYDW, wm_concat(ypbh) ypbhs, wm_concat(ddxdm) ddxdms,decode(count(ypbh),null,0,count(ypbh)) BQJSSL
      from (select xm, yp, fy,RWDBH,SYDW, ypbh
              from Tickdetail
             where fbbs = '1'
               and SFJS ='1'
                  and FBRQ between to_date('2019-1-1','yyyy-mm-dd') and
                                 to_date('2020-5-1','yyyy-mm-dd')
             group by xm, yp, fy, RWDBH,SYDW, ypbh)
     group by xm, yp, fy,SYDW, RWDBH)b,
     
     (select xm, yp, fy,SYDW, RWDBH, decode(count(ypbh),null,0,count(ypbh)) BQWCSL
                   from (select xm, yp, SYDW,fy, RWDBH, ypbh
                           from Tickdetail
                          where fbbs ='1'
                        and FBRQ between to_date('2019-1-1','yyyy-mm-dd') and
                                 to_date('2020-5-1','yyyy-mm-dd')
                          group by ddxdm, ypph,SYDW, fyly, RWDBH, ypbh)
                  group by ddxdm, ypph, fyly,SYDW, RWDBH) c,       
       Ypfxprice f 
      where a.ypph = b.ypph
       and a.ddxdm = b.ddxdm
       and a.fy = b.fy
       and a.ddxdm = f.fxxmdm 
       and BQJSSL != '0'
       and a.ypph = c.ypph
       and a.ddxdm = c.ddxdm
       and a.fyly = c.fyly
       )
     group by
     FY,jldw,SYDW order by SYDW, FY,jldw 

修改之后脚本:

select row_number() over(ORDER BY SYDW,jldw,FYLY) xh,
SYDW,
jldw,
FYLY,
wm_concat(ddxdms) ddxdms,
sys.stragg(to_char(ypbhs) || nvl2(ypbhs,’’, ‘’’’)) as ypbhs, --此处修改
sum(SDWCSL) SDWCSL,
sum(BQJSSL) BQJSSL,
sum(BQWCSL) BQWCSL,
TO_CHAR(sum(JSSL) / sum(BQWCSL)*100,‘FM99990.00’) jsbfl ,
TO_CHAR(sum(WCSL) / sum(YJYWCDGSL)*100,‘FM99990.00’) jsbfl
from (
select f.jldw,
SDWCSL,
a.FYLY,
b.ddxdms,
b.ypbhs,
BQJSSL,
BQWCSL,
LJWCSL,
a.SYDW,
YJYWCDGSL
from (select ddxdm, XM, yp, fy, RWDBH,SYDW, decode(count(ypbh),null,0,count(ypbh)) WCSL
from (select ddxdm, XM, ypph, fy, RWDBH, SYDW,ypbh
from Tickdetail
where fbbs =‘1’
and FYLY !=‘0’
and FBRQ between to_date(‘2019-1-1’,‘yyyy-mm-dd’) and
to_date(‘2020-5-1’,‘yyyy-mm-dd’)
group by ddxdm, XM, yp, fy, RWDBH,SYDW, ypbh)
group by ddxdm, XM, yp, fy,SYDW, RWDBH) a,

     (select xm, yp, fy, RWDBH,SYDW, wm_concat(ypbh) ypbhs, wm_concat(ddxdm) ddxdms,decode(count(ypbh),null,0,count(ypbh)) BQJSSL
      from (select xm, yp, fy,RWDBH,SYDW, ypbh
              from Tickdetail
             where fbbs = '1'
               and SFJS ='1'
                  and FBRQ between to_date('2019-1-1','yyyy-mm-dd') and
                                 to_date('2020-5-1','yyyy-mm-dd')
             group by xm, yp, fy, RWDBH,SYDW, ypbh)
     group by xm, yp, fy,SYDW, RWDBH)b,
     
     (select xm, yp, fy,SYDW, RWDBH, decode(count(ypbh),null,0,count(ypbh)) BQWCSL
                   from (select xm, yp, SYDW,fy, RWDBH, ypbh
                           from Tickdetail
                          where fbbs ='1'
                        and FBRQ between to_date('2019-1-1','yyyy-mm-dd') and
                                 to_date('2020-5-1','yyyy-mm-dd')
                          group by ddxdm, ypph,SYDW, fyly, RWDBH, ypbh)
                  group by ddxdm, ypph, fyly,SYDW, RWDBH) c,       
       Ypfxprice f 
      where a.ypph = b.ypph
       and a.ddxdm = b.ddxdm
       and a.fy = b.fy
       and a.ddxdm = f.fxxmdm 
       and BQJSSL != '0'
       and a.ypph = c.ypph
       and a.ddxdm = c.ddxdm
       and a.fyly = c.fyly
       )
     group by
     FY,jldw,SYDW order by SYDW, FY,jldw 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值