Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: oracle date problem
krish wrote:
> I have a query which has a date comparision in the where clause.
>
> The query looks as
>
> 1. select count(*) from table where DTTM > '10-Jan-06';
>
> 2. select count(*) from table where to_char(DTTM) > to_char('2006-01-10
> 12:35:44');
>
> 3. select count(*) from table where to_date(DTTM, 'yyyy-mm-dd
> hh24:mi:ss') > to_date('2006-01-10 12:35:44', 'yyyy-mm-dd hh24:mi:ss');
Q1 is doing a date comparison (assuming DTTM is defined as a DATE column).
Q2 is doing a string comparison.
Q3 is doing a data comparison but against a different constant (i.e. it's comparing to 2006-01-10 12:35:44 whereas Q1 is comparing 2006-01-10 00:00:00).
-- To reply by email remove "_nospam"Received on Wed Feb 22 2006 - 14:16:59 CST