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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: [Q] ORACLE date select problem?

RE: [Q] ORACLE date select problem?

From: Diana Duncan <Diana_at_fileFRENZY.com>
Date: Fri, 13 Oct 2000 13:46:08 -0400
Message-Id: <10648.119222@fatcity.com>


I know there have been tons of answers to this, but I just want to make sure that both problems are understood.

  1. You are doing a character comparison. You need to do a date comparison, by, as many other have pointed out, "where datestamp < to_date('31-DEC-1996', 'DD-MON-YYYY')"
  2. If you don't do the YYYY conversion there, you are actually comparing against 31-DEC-2096, not 31-DEC-1996. Obviously, 21-JAN-1998 is less than 31-DEC-2096. Using 'RR' would help, but I don't trust RR.

HTH,
Diana

-----Original Message-----
From: L [mailto:leed_at_chele.cais.net]
Sent: Friday, October 13, 2000 11:35 AM
To: Multiple recipients of list ORACLE-L Subject: [Q] ORACLE date select problem?

On ORACLE 7.3.4 database, I tried to select date less than "31-DEC-96". the following statement does NOT work correctly:

   select account_id, datestamp from table1    where to_char(datestamp,'DD-MON-YY') < '31-DEC-96';

It still print date like '21_JAN-98'.

Anyone can give me a hint?

Thanks

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: L
  INET: leed_at_chele.cais.net

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Fri Oct 13 2000 - 12:46:08 CDT

Original text of this message

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