Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: decode by range?
David Plotner <david_plotner_at_ncsu.edu> schreef in berichtnieuws
39107F14.A498D14D_at_ncsu.edu...
> I have a need to group data into several categories (4 or 5) by ranges
> of dollar amounts. For example, data needs to be grouped into <$2500,
> 2500 to 50000, 50000 to 100000, > 100000.
>
> I thought that the decode function might work for these, but can compare
> an expression to a range. I also tried to do something with a boolean,
> but couldn't get that to work either. The best option I have found is to
> decode a sign of the difference between an expression and some amount.
> This can be used to decode to >, =, and < values only. Still too limited
> for my needs. Anyone have any suggestions?
>
> TIA,
>
> -david plotner-
>
The last remark I don't see, as you can nest decodes
say
decode(sign(amount - 1000), 1, decode(...), something) etc.
Hth,
Sybrand Bakker, Oracle DBA Received on Wed May 03 2000 - 00:00:00 CDT