Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

date comparison

DBA_1976Sep 3 2010 — edited Sep 3 2010
Hi Gurus,
I have a table T with a date column dt_col. I ran a sql to filter based on that column. But I have some doubts.


select dt_col from T where to_char(dt_col, 'MM/DD/YYYY') between '08/16/2010' and '08/20/2010';

This gives results from all over the table. i.e. the filter is not working. But

select dt_col from T where dt_col between to_date('08/16/2010' , 'MM/DD/YYYY') AND to_date('08/20/2010', 'MM/DD/YYYY');

this gives the correct results. I don't understand why the first query did not work. Please some one explain.

Thanks,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 1 2010
Added on Sep 3 2010
5 comments
700 views