Re: NEWBIE: conditional query

From: Matt Marrow [LOGICA][dc] <mmarrow_at_diana>
Date: 1996/11/20
Message-ID: <56vaig$89q_at_zeus.mobile.com>#1/1


How about

SELECT DECODE(SIGN(SYSDATE- your_date_col),1,NULL,'CLOSED') FROM your_table;

(Date subtraction yields result in days units (including decimal for hours,minutes and seconds) so if the sign of SYSDATE-yourdate is positive, that means SYSDATE is after yourdate)

Hope that helps

Matt

mmarrow_at_pacbell.mobile.com

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)
Received on Wed Nov 20 1996 - 00:00:00 CET

Original text of this message