Basically, the question says it all. I need a PL\SQL query that returns a list of dates between two dates such that for 01-JAN-2010 to 20-JAN-2010 I would get 20 rows returned:
the_date
--------
01-JAN-2010
02-JAN-2010
03-JAN-2010
04-JAN-2010
...
20-JAN-2010
Here’s an example from postgres, I hope the dialects are comparable in regards to recursive
…will return 20 records, numbers from 1 to 20
Cast/convert these to dates and there you are
UPDATE:
Sorry, don’t have ORA here, but according to this article
gives
It is also stated that this is supposed to be very efficient way to generate rows.
If ROWNUM can be used in the above select and if variable can be used in LEVEL condition then solution can be worked out.
UPDATE2:
And indeed there are several options.
orafaq states that: ‘It should be noted that in later versions of oracle, at least as far back as 10gR1, operations against dual are optimized such that they require no logical or physical I/O operations. This makes them quite fast.’, so I would say this is not completely esoteric.