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 -> Select particular day of week over given date range?

Select particular day of week over given date range?

From: Ian Brandt <ibrandt_at_aol.com>
Date: Tue, 14 May 2002 15:11:29 -0400
Message-ID: <BhdE8.6681$Wh.3528@atlpnn01.usenetserver.com>

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 Received on Tue May 14 2002 - 14:11:29 CDT

Original text of this message

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