Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Decode Statement

Re: Decode Statement

From: Linda Turner <LindaTuner_at_hotmail.com>
Date: Sat, 13 Oct 2001 11:18:49 GMT
Message-ID: <tqVx7.9825$YC3.3488910@typhoon.southeast.rr.com>


You didn't mention a version, but 8i has a "case" statement which might be easier to use than DECODE.

"Dennis Hancy" <dennishancy_at_eaton.com> wrote in message news:248587ca.0110110611.75adb19e_at_posting.google.com...
> Mark Styles <news_at_lambic.co.uk> wrote in message
news:<9l89stg58ei7jsjle75mfbbvv29cmrsnha_at_4ax.com>...
> > On 10 Oct 2001 12:01:44 -0700, dennishancy_at_eaton.com (Dennis
Hancy)
> > wrote:
> >
> > >A typical Decode statement looks like this..
> > >
> > >decode(value, if1, then1, if2, then2...)
> > >
> > >
> > >Can the "if" values be replaced with a range? For instance, what
if
> > >you wanted to check if "value" is between 1 and 10.
> > >
> > >Could you do this...
> > >
> > >decode(value, between 1 and 10, then1, if2, then2...) ?
> >
> > For A between B and C:
> >
> > DECODE( SIGN(a-b),
> > 1, DECODE( SIGN(a - c),
> > -1, TRUE,
> > FALSE ),
> > FALSE)

>
>

> Thanks!!
>

> Hey, I had to modify this slightly, since my values are character
> data, but I go it to work.
>

> Here's what I did for character data...
>
>

> decode( greatest(A,b),
> A, decode( least(A,c), A, TRUE, FALSE),
> FALSE
> )
> >

> Same concept as SIGN. I might need to double check the end point
> values (for instance if A=b or A=c), but this works great.
>

> Thanks for your help.
>
>

> Dennis
Received on Sat Oct 13 2001 - 06:18:49 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US