Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Date comparison question.
Oracle stores the time along with date....
The to_char function you are using 'YYMMDD' is removing the time
element. If you were to try to_char(sysdate,'YYMMDD HH24:MI:SS')
you'll get a better idea of what I mean.
Robert Prendin
Michael Rothwell <michael_rothwell_at_non-hp-usa-om46.om.hp.com> wrote:
>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 Wed May 20 1998 - 21:29:49 CDT
![]() |
![]() |