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

Home -> Community -> Usenet -> c.d.o.server -> date comparison problem

date comparison problem

From: Michael Rothwell <michael_rothwell_at_non-hp-usa-om46.om.hp.com>
Date: Tue, 19 Jan 1999 17:35:12 -0800
Message-ID: <36A532D0.DB32695D@non-hp-usa-om46.om.hp.com>


I have a table ENGAGEMENT_EXPENSE that has a column EE_DATE that is currently a CHAR(8) (this will be changed to a DATE type in the next two months).

When I run the following SQL against the table

select distinct ee_date from engagement_expense  where EE_DATE <= to_char( add_months( last_day( trunc( sysdate ) ),-1 ),'yymmdd' )
 order by ee_date

I get all of the dates except '981231'

However I do get that date when I replace the WHERE clause as follows:

select distinct ee_date from engagement_expense  where EE_DATE <= '981231'
 order by ee_date

or when I use:

select distinct ee_date from engagement_expense  where to_date(EE_DATE, 'YYMMDD') <=
last_day(add_months(sysdate,-1) )
 order by ee_date

What happens to 981231 in the first example??

Michael
--
Michael A. Rothwell
Oracle DBA/Web Developer

Views expressed here are not those of my company - No - Wait - Since I am independent, I guess they are the views of my company. Received on Tue Jan 19 1999 - 19:35:12 CST

Original text of this message

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