Re: NEWBIE: conditional query
Date: 1996/11/20
Message-ID: <56ve1i$75d_at_sussi.cressoft.com.pk>#1/1
"Peter Wenker" <peter.wenker_at_mci.com> wrote:
>I'm trying to select different values from a DATE field based upon the
>value of the date. Specifically, I want to query all rows in a table with
>a DATE field. I want the query to return a value of 'CLOSED' if the date
>is less than or equal to SYSDATE, and NULL if the date is greater than
>SYSDATE. Is this possible? I'm familiar with SQL*PLUS but not as
>familiar with its advanced functionality.
>Appreciate any help - thanks - john.sauer_at_MCI.com
> (please cc peter.wenker_at_MCI.com)
Hi Peter,
If we take the emp table and the hiredate field as the date field then
probabaly this one liner could help
select
decode(sign(hiredate-trunc(sysdate)),-1,'Closed',1,null,'Closed') from
emp
Saqib Zulfiqar
Software Engineer
CresSoft Software Products
Received on Wed Nov 20 1996 - 00:00:00 CET