Re: date series

From: Keimel Bernhard <bkeimel_at_edu.uni-klu.ac.at>
Date: Sat, 21 Jul 2001 21:53:39 GMT
Message-ID: <3b2c6a0b$1_at_news.uni-klu.ac.at>


hi,

i would not prefer doing this. querying a table that contains everything but the elements you want to query, just to make use of the rownum ... will create a lot of possible errors for your query. what if someone changes the data in this table (f.i. deletes all rows)? your query will fail, suddenly. no way.

create a table for your date-entries. fill the entries with timestamps of your desired granularity. create an index for those entries, this will make your queries very performant and this table won't be very large.

greetings,
kuemi

"Ilya Kuzkin" <elliew_at_hotmail.com> schrieb im Newsbeitrag news:9cplkq$kkf$1_at_news3.cadvision.com...
> Hi, Jean!
>
> Here's a simple solution without creating any additional tables
> Pick up a table that definitely contains more records than the number of
> days in your date interval.
> Then issue the following query: (let's assume the start day is
 Jan-01-2001,
> the end day is Feb-01-2001)
>
> The following query will return you all days within the interval:
>
> select to_date('01-JAN-2001','DD-MON-YYYY')+ROWNUM-1 from TABLE_X
> where
>

 ROWNUM<=to_date('01-FEB-2001','DD-MON-YYYY')-to_date('01-JAN-2001','DD-MON-Y
> YYY')+1
>
> Cheerz,
>
> Ilya Kuzkin.
>
>
>
>
>
>
>
> Jean <ken_jean_at_hotmail.com> wrote in message
> news:9coopd$70d$1_at_serv1.iunet.it...
> > Hi to all.
> > I'm developing a web application based on Oracle 8.i database
> > I need a query that outputs date series betweet two dates.
> > For example I have start date 01-05-2001 (DD-MM-YYYY) and end date
> > 07-05-2001 (DD-MM-YYYY) and the query results must be
> > 01-05-2001
> > 02-05-2001
> > 03-05-2001
> > 04-05-2001
> > 05-05-2001
> > 06-05-2001
> > 07-05-2001
> > I say that it can be possible using calendar functions but I'm not able
 to
> > use it.
> > Can anyone help me?
> > All solutions is appreciated.
> > Thank a lot in advance.
> > Bye
> >
> > JEAN
> >
> >
>
>
Received on Sat Jul 21 2001 - 23:53:39 CEST

Original text of this message