That's because the following codeOriginally posted by zedd
Actually, I did have that. Problem is, for some reason, it misses the end of the month. Eg, the 30th Nov. I'll get records until the 29th.
returns true only for ATB_DTTM dates that have no time portion on the last day of November. In other words, for the last day of November it will be true only for those records that have ATB_DTM exatly at midnight between 29th and 30th of November, ie TO_DATE('11/30/2003 00:00:00','MM/DD/YYYY HH24:MI:SS'). Apparently all your ATB_DTTM values on 11/30/2003 have time portion greaqter than '00:00:00', that's why they were not included in the resultset.Code:AND BERTHING.ATB_DTTM BETWEEN TO_DATE('10/01/2003','MM/DD/YYYY') AND TO_DATE('11/30/2003','MM/DD/YYYY')
To fix this, you have many options, for example:
1. (this option will prevent the usage of the index on ATB_DTTM if it exists, so might not be the best choice)
2.Code:AND TRUNC(BERTHING.ATB_DTTM) BETWEEN TO_DATE('10/01/2003','MM/DD/YYYY') AND TO_DATE('11/30/2003','MM/DD/YYYY')
3.Code:AND BERTHING.ATB_DTTM BETWEEN TO_DATE('10/01/2003','MM/DD/YYYY') AND TO_DATE('11/30/2003 23:59:59','MM/DD/YYYY HH24:MI:SS')
etc etcCode:AND BERTHING.ATB_DTTM >= TO_DATE('10/01/2003','MM/DD/YYYY') AND BERTHING.ATB_DTTM < TO_DATE('12/01/2003','MM/DD/YYYY')




Reply With Quote