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* to implement IF condition???

Re: *DECODE* to implement IF condition???

From: <kanucme_at_notyet.com>
Date: Sun, 04 Nov 2001 10:35:59 -0500
Message-ID: <9s3n8b055e@enews3.newsguy.com>

If you are running 8i you can use the CASE syntax :

SELECT col1_value, (CASE date1 < sysdate and date2 > sysdate then

                                      'ABC YES'
                                ELSE
                                                        'DEF NO'
)
from table_1

The syntax might not be exactly right above, but you can research it . You can nest CASEs too.. but each case is limited to 255 cases.

On 30 Oct 2001 22:16:17 -0800, yrg01_at_yahoo.com (Vamshi) wrote:

>HI All,
>I have a conditional display situation as below:
>
>if T1.Col4 = 'ABC'
>{ if ( (T1.date1 < sysadate) && (T1.date2 > sysdate) )
> { DISPLAY 'ABC YES';
> }
> else
> { DISPLAY 'ABC NO';
> }
>}
>else if T1.Col4 = 'DEF'
>{ if ( (T1.date1 < sysadate) && (T1.date2 > sysdate) )
> { DISPLAY 'DEF YES';
> }
> else
> { DISPLAY 'DEF NO';
> }
>}
>else
>{ DISPLAY "NEITHER ABC NOR DEF"
>}
>
>Can this condition be implemented in a select statement with DECODE...
>that looks like
>
>****************************************
>Select decode(.....some smart logic.....)
>from table T1
>****************************************
>
>Any clues on how to approach this?
>
>Thanks folks!
>
>Cheers,
>Vamshi Reddy
Received on Sun Nov 04 2001 - 09:35:59 CST

Original text of this message

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