11g
Hi gurus,
I have a table T1 with three columns
Id Col1 Col2 Col3
1 O P null
2 null P C
3 null null null
4 O P C
5 O null C
6 O null null
The output should be a comma separated list of col1, col2, col3
E.g
Select decode(col1,null,null,'O, ')||decode(Col2,null,null,'P, ')||decode(Col3,null,null,'C') from T1
The problem is that if the last of the three cols have null, then there is a redundant ' ,' So output is
O,P,
P,C
null
O,P,C
O,C
O,
The first and last row has the comma.So is there a way to format this so that the redundant comma can be eliminated.
Thank
Ryan