Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: I have a problem with the oracle date comparison --plz help
Because you are forgetting the time portion:
2005/09/19 14:25 is greater than 2005/09/19 00:00 (the result of
TO_DATE('19-SEP-05' , 'dd-mon-yy') )
-- Terry Dykstra Canadian Forest Oil Ltd. <jambesh_at_gmail.com> wrote in message news:1127250126.992203.86470_at_g49g2000cwa.googlegroups.com...Received on Tue Sep 20 2005 - 16:16:02 CDT
> Hi , every body
>
> I have written a query
>
> -------------------- QUERY------------------------------
> select count(*) from newtable where order_tm > TO_DATE('19-SEP-05' ,
> 'dd-mon-yy') and order_tm < to_date('21-SEP-05','dd-mon-yy') and
> status='APPROVE'
> ------------------------------------------------------------
>
>
> --------------------RESULT--------------------------------
> this give me a result of 50
> ----------------------------------------------------------
>
>
> when i remove count(*) to see all field and put * over ther i can see
> ...this query select the order from 19th sep also which it should not
> as i have given a greater then symbol on that condition.
>
> can you please explain me why it is happening so..??
>
>
> is this query be substitute as approve_tm = '20-SEP-05' and
> status='APPROVE' what is wrong with this query ??? it doesn't give
> currect result.
>