| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.oracle -> Re: I must be missing the obvious
Mark D Powell wrote:
> D Rolfe <dwrolfeFRUITBAT_at_orindasoft.com> wrote in message news:<40E2E63F.9090805_at_orindasoft.com>... >
> > > I would think that you might want to look at the add_month and > last_day date functions which would allow you to calculate the > previous month from the sysdata and determine the last day of that > month. A trunc of the add_months(sysdate, -1) would give you the > first day of the prior month. >
I am working on the assumption he wants a month that starts at:
01-Jun-04 00:00:00
and
30-Jun-04 23:59:59
He also mentioned that SYSDATE is used to populate the column, which means the DATE will be accurate to one second.
Because the BETWEEN operator is inclusive the search expression needs to allow for the fact that the reporting period ends at 23:59:59. This means that the end date must exclude '01-Jul-04 00:00:00'. This implies working in seconds. You can either:
Failure to account for seconds will lead to reports that count transactions at midnight on the first day of a month as being in two seperate months. This can harm your end of year bonus.
David Rolfe
Orinda Software
Dublin, Ireland
Received on Thu Jul 01 2004 - 02:26:01 CDT
![]() |
![]() |