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 -> Re: Date comparison question.

Re: Date comparison question.

From: Matt Brennan <mbrennan_at_gers.antispam.com>
Date: Fri, 22 May 1998 21:39:52 GMT
Message-ID: <01bd85ca$2152bb80$049a0580@mcb>


You need to truncate the date first because there is a time component stored behind the scenes and that's why you aren't getting a match. Using "trunc" will treat the time as 00:00:00 regardless of what it really is. --
Matt Brennan
SQL*Tools Specialist
GERS Retail Systems
9725-C Scranton Road
San Diego, California 92121
1-800-854-2263
mbrennan_at_gers.com
(Original email address is spam-blocked.)

Michael Rothwell <michael_rothwell_at_non-hp-usa-om46.om.hp.com> wrote in article <35635BD8.6024B890_at_non-hp-usa-om46.om.hp.com>...
> I have a function workday.getday(nn) that returns a date.
>
> For instance: select workday.getday(5) from dual
> returns 07-MAY-98
>
> Today 5/20/98 if I: select sysdate - 13 from dual
> it also returns 07-MAY-98
>
> if I use DECODE to test the equivalence of these two dates
> it returns a false code.
>
> select decode( sysdate-13, workday.getday( 5 ), 1, 0 ) from
> dual
> returns 0
>
> but if I convert from date to CHAR it works returns a true
> code.
>
> select decode( to_char( sysdate-13, 'YYMMDD' ),
> to_char( workday.getday( 5 ), 'YYMMDD' ), 1,
> 0 )
> from dual
> returns 1
>
> Why does the comparison not work when both are left in date
> format?
>
> Michael.
>
Received on Fri May 22 1998 - 16:39:52 CDT

Original text of this message

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