Issue with Oracle to_char between dates
908596Jan 3 2012 — edited Jan 3 2012Hi,
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!