Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to transfer year, week, day to date

Re: How to transfer year, week, day to date

From: Norbert Vossiek <norbert.vossiek_at_gmx.li>
Date: Thu, 13 Jun 2002 12:03:08 +0200
Message-ID: <ae9qui$p91$05$1@news.t-online.com>


Mike,

I agree.

Marcel,

Get a DWH textbook and read about time dimension tables.

Operations on date entities can be very tricky. The basic idea behind time dimension tables is, to do those calculations once one record for every day for some dozens of relevant years (whether it takes just a second or an hour, it does not matter at all). And when it comes to the time you need the information, just grab it:

SELECT time_key
FROM time_dimension
WHERE year = 2002
AND week_in_year = 24
AND day_in_week = 1

And be aware that the definition of the first week of a year may differ from country to country.

To say it differently, Niklaus Wirth once wrote this nice book called Algorithms + Data Structures. It better should be named Algorithms OR Data Structures, since good data structures reduce the complexity of the algorithm and vice versa.

Norbert

<MSherrill_at_compuserve.com> schrieb im Newsbeitrag news:3d0759ae.179678423_at_news.compuserve.com...
> On 10 Jun 2002 04:45:46 -0700, mraap_at_yahoo.com (Marcel Raap) wrote:
>
> >I need a SQL-statement (or PLS/SQL function) that accepts a year, a
> >week number and a day number as input and returns a date.
>
> First, you have to specify how you handle the first week of the year
> and of the first day of the week. But IME, the best place for data is
> in a table.
>
> --
> Mike Sherrill
> Information Management Systems
Received on Thu Jun 13 2002 - 05:03:08 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US