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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Select particular day of week over given date range?

Re: Select particular day of week over given date range?

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Tue, 14 May 2002 19:21:25 GMT
Message-ID: <3CE163B4.CA9B59C6@exesolutions.com>


Ian Brandt wrote:

> Hi,
>
> I'm trying to do something like...
>
> select [every friday] from dual
> where [every friday] >= to_date('[start date]', 'MM-DD-YYYY')
> and [every friday] <= to_date('[end date]', 'MM-DD-YYYY')
>
> In other words, I'm trying to dynamically generate a list of dates for
> a particular day of the week, that fall within a given range, out of
> thin air. I see that I can use the next_day function to get the first
> occurrence of the particular day of the week in the given range, and
> if I could some how call that recursively until the result is <= the
> end date I'd be all set. Is it possible to do that in SQL, or is
> there an alternative strategy that is, or do I need to teach myself
> PL/SQL to do something like this?
>
> Thanks!
>
> Ian

This is something properly done in an anonymous block or stored procedure within a loop.

Daniel Morgan Received on Tue May 14 2002 - 14:21:25 CDT

Original text of this message

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