ORA-22922: 不存在的 LOB 值 可以使用外层嵌套wm_concat()解决

select kw0408id,
sjbh,
ksrs,
kch,
to_char(wm_concat(kcmc)) as kcmc,
ksxs,
kssc,
ksfs,
kcxz,
xsyx,
nj
from (select a.kw0408id,
a.sjbh,
a.ksrs,
kch,
kcmc,
to_char(wm_concat(distinct KSXS.DMMC)) as ksxs,
to_char(wm_concat(distinct kssjcd.dmmc)) as kssc,
to_char(wm_concat(distinct zzdksfs.dmmc)) as ksfs,
to_char(wm_concat(distinct zzdkclb.dmmc)) as kcxz,
to_char(wm_Concat(distinct xx0301s.dwmc)) as xsyx,
to_char(wm_Concat(distinct Jx01ND.Ksnd)) as nj
from v_kw0408 a
left join kw0406
on a.kw0408id = kw0406.kw0408id
left join zzdKSXS KSXS
ON kw0406.ksxs = ksxs.dm
left join zzdKSSJCD kssjcd
on kw0406.kssjcd = kssjcd.dm
left join jx0404
on kw0406.jx0404id = jx0404.jx0404id
left join zzdkclb
on jx0404.kcsx = zzdkclb.dm
left join zzdksfs
on jx0404.ksfs = zzdksfs.dm
left join kw0407 kw0407s
on kw0407s.kw0406id = kw0406.kw0406id
left join xx04 xx04s
on xx04s.xx04id = kw0407s.bjbh
left join xx0301 xx0301s
on xx0301s.xx0301id = xx04s.xx0301id
left join Jx01ND
on xx04s.jx01ndid = Jx01ND.Jx01ndid
where SGKW0403ID is null
and (a.kw0408id in ('590',
''))
and a.kw0401id = '29'
group by a.kw0408id, a.sjbh, a.ksrs, kch, kcmc)

 

posted on 2017-04-25 22:42  知了不了了之  阅读(4277)  评论(0编辑  收藏  举报