Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: date series
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 Wed May 02 2001 - 14:02:35 CDT