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

Home -> Community -> Usenet -> c.d.o.tools -> Re: date series

Re: date series

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Wed, 2 May 2001 14:09:34 +0100
Message-ID: <988808956.23968.0.nnrp-12.9e984b29@news.demon.co.uk>

An alternative strategy to do the same sort of thing is to call a function that returns a suitable array of meaningless rows. Then apply the method below.

For an example see my web-site under:
  miscellaneous -> dummy data

--
Jonathan Lewis
Yet another Oracle-related web site:  http://www.jlcomp.demon.co.uk

Practical Oracle 8i:  Building Efficient Databases
Publishers:  Addison-Wesley

Reviews at: http://www.jlcomp.demon.co.uk/book_rev.html



Marc Billiet wrote in message <20010502.12151090_at_y1032960.hae.hydro.com>...
Hi,

First look for a table which constantly contains a lot of rows. In my
example, I have taken user_tab_columns.
Then execute following query:

select :date1 + rownum - 1
from user_tab_columns
where rownum <= (:date2 - :date1) + 1

'date1' contains the start date (01-05-2001), and 'date2' contains the
end date (07-05-2001).

Or hardcoded:

select to_date('01-05-2001','DD-MM-YYYY') + (rownum-1)
from user_tab_columns
where rownum <= to_date('07-05-2001','DD-MM-YYYY')-to_date('01-05-2001',
'DD-MM-YYYY') + 1

Marc

>>>>>>>>>>>>>>>>>> Oorspronkelijk bericht <<<<<<<<<<<<<<<<<<

Op 2001-05-02, 12:47:59, schreef "Jean" <ken_jean_at_hotmail.com> over het
thema date series:



> 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 - 08:09:34 CDT

Original text of this message

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