manas could you show it to me then coz if it is some definite number then its easy we can do something like

select loomno,decode (reason1 ,nvl(reason1,0),value..................................)
group by blah

but with thousands of reasons one has to go on writing reason 1........................reason 1000

if you have a better way why not post the solution