Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: DECODE question
You want:
Decode(sign(sum(a.amount)-10000),-1,'Yes',0,'No',1,'No','No')
which could be shortened to:(but I like the above since making <= an easy
switch)
Decode(sign(sum(a.amount)-10000),-1,'Yes','No')
Jim
"Mark Hamilton" <user_at_user.net> wrote in message
news:ub48rmdhd2s3b3_at_corp.supernews.com...
>
> I'm familiar with how to do a DECODE statement like below to find if the
> first letter of 'j.Field' = 'R':
>
> DECODE(substr(j.Field,1,1), 'R', 'Yes', 'No')
>
> A similar function testing for numeric criteria does not work:
>
> DECODE (sum(a.Amount), < 10000, 'Yes','No').
>
> How can I check for numeric criteria in SQL and give substitutions based
on
> the results in a manner similar to DECODE?
>
> Thanks,
>
> Mark Hamilton
>
>
>
>
Received on Mon Apr 08 2002 - 20:16:16 CDT