Oracle 11g SQL - Relpacing NULLS with zero where query has PIVOT -
i have following sql code returning data require, im trying replace occurrences of null zero.
select * ( select table1.itmcod, table1.itmdsc, table2.grpdsc, table3.zondsc,coalesce(table4.casqty,0) qty,coalesce(table4.qastat,'0') qastat table5 join table1 on blditm.itmcod = table1.itmcod join table3 on table5.put_zonlst = table3.zonlst join table2 on table2.group = table1.group left join table4 on table1.itmcod = table4.itmcod ) pivot (sum(qty) qastat in ('rl' rl,'hd' hd) )order itmcod;
i have tried replacing coalesce nvl still same results shown. nulls im trying rid of in rl , hd columns.they not actual fields in of tables, produced pivot function.
note first occurrence of coalesce in code replaces nulls actual zero, while second character '0'. tried 0 gave error. should both numbers (zero)
im not experienced in sql , appreciate on this.
solution found!
out of trial , error managed solve :)
basically, instead of select * from
@ beginning of code, entered actual field names , coalesce functions shown,
select itmcod, itmdsc, grpdsc, zondsc,coalesce(rl,0) rl,coalesce(hd,0) hd
i hope else similar problem.
thanks
Comments
Post a Comment