Re: DECODE explanation [message #2695] |
Tue, 06 August 2002 21:01 |
Ravi
Messages: 251 Registered: June 1998
|
Senior Member |
|
|
Yes you are right.
"sum(decode(ltrim(a),'08',b*c,0))"
=
if ltrim(a) = '08' then b*c else 0
AND
"sum(decode(ltrim(a),'01',0,'02',0,'03',0,'04',0,'05',0,'06',0,'07',0,'08',0,to_number(b)*c))"
=
if ltrim(a) = '01' then 0
if ltrim(a) = '02' then 0
if ltrim(a) = '03' then 0
if ltrim(a) = '04' then 0
if ltrim(a) = '05' then 0
if ltrim(a) = '06' then 0
if ltrim(a) = '07' then 0
if ltrim(a) = '08' then 0
else to_number(b)*c ............ (if any of above is not true)
let me know if unclear
Ravi
|
|
|