Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to generate a list of dates between two dates?
Michael Keppler wrote:
>
> Hi everybody !
>
> For a query I need all (possible) dates between two given dates. Is
> there a simple query to generate all of them ? Or do I have to use a
> table with all the dates in it?
>
> Ciao and Thanks, Michael.
>
Declare
Currdate Date := Null;
LowDate Const Date := To_Date('20000110','YYYYMMDD');
HiDate Const Date := To_Date('20000322','YYYYMMDD');
Begin
dbms_output.enable(1000000);
CurrDate := LowDate;
While CurrDate <= HiDate Loop
dbms_output.put_line(to_char(CurrDate,'YYYYMMDD'); ++Currdate;
Or something like that. Received on Tue Jan 11 2000 - 11:08:33 CST