RE: help with a monthly rollup
Date: Tue, 13 May 2008 13:02:12 -0500
Message-ID: <7070047601C21A4CB387D50AD3661F6E09BA9FDF@050EXCHANGE.research.na.admworld.com>
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions
072.htm#i83733
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Rick Ricky
Sent: Tuesday, May 13, 2008 12:45 PM
To: oracle-l_at_freelists.org
Subject: help with a monthly rollup
I need to rollup data by month.
There are a couple ways to do this.
I have a date field. So I can rollup with a to_char(mydate,'YYYYMM')
this requires a where clause as followings
where to_char(mydate,'YYYYMM') = pSomeMonth;
This means I need a function based index to support this. We have alot of data, so where possible, I want to avoid adding more indexes. Is there a way to calculate what the last
day of the month is?
so I can use a between as follows
where myDate between to_date(01-MON-YYYY') and to_date(LASTDAYOFMONTH-MON-YYYY')
Since the last day of the month can be
28,29,30,31
CONFIDENTIALITY NOTICE:
This message is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged,
confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this
communication in error, please notify us immediately by email reply.
-- http://www.freelists.org/webpage/oracle-lReceived on Tue May 13 2008 - 13:02:12 CDT