Skip to Main Content

Oracle Database Discussions

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!

Issue with Oracle to_char between dates

908596Jan 3 2012 — edited Jan 3 2012
Hi,
I ve written a query which picks up data between 16:00 hrs of previous date to 15:59 of current date. The query was working fine except for 1 date range given below:

select count(*) from table1 where TO_CHAR(INSERT_DATE , 'MMDDYYYY HH24MISS') between '12312011 160000' and '01012012 155900'

This formatting (to_char) is not working for data between Dec 31, 2011 and Jan 01, 2012. The query returns 0 rows.
Not able to figure out the issue here... pls help!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 31 2012
Added on Jan 3 2012
7 comments
4,702 views