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: Dave <googroo_at_jazman.freeserve.co.uk>
Date: 2 Nov 2001 07:08:51 -0800
Message-ID: <9c8f4d24.0111020708.5e6d5dbf@posting.google.com>


How about:

foo := " NO"
if (T1.date1 < sysadate) && (T1.date2 > sysdate) then foo := " YES" ad := t1.col4 || foo
select decode(t1.col4,"ABC",ad,"DEF",ad,"NEITHER") from dual;

(untested code; just getting the idea down)

avoids trying to mess about with the sign from subtracting dates...uck.

Dave.

yrg01_at_yahoo.com (Vamshi) wrote in message news:<b97132c2.0110302216.5b4ab808_at_posting.google.com>...
> 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 Fri Nov 02 2001 - 09:08:51 CST

Original text of this message

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