Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: modeling year and month for summary data
> -----Original Message-----
> Steiner, Randy
>
> I have a table that will contain sales monthly summary. I am
> not sure which
> is the better way to handle the date of the data. I can
> create a year field
> and a month field or I can create a date field and force in
> the day e.g.
> 2003 November's data can be 01-Nov-03 .
>
> Is there a censuses on which way to handle the date?
A consensus? I think probably not. :)
I like the idea that the date datatype performs validation on the values entered.
I personally would create a date field with a before insert/update trigger that sets
:new.date := trunc (:new.date, 'MM') ;
If you need an index on year then you can use a function based index on trunc (date, 'YYYY')
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Jacques Kilchoer INET: Jacques.Kilchoer_at_quest.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Fri Nov 14 2003 - 18:09:25 CST
![]() |
![]() |