Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL query to determine Fiscal Week

833855Jan 24 2011 — edited Jan 27 2011
Hi Experts,

I need to figure out the fiscal week for a specific datetime field based on the following requirements:

1. A week Starts on Saturday and Ends on Friday.
2. If Feb 1st of a given year is a Saturday, then week 1 will run from February 1st to February 7.
3. If Feb 1st is not on a Saturday, then week 1 starts on the previous Saturday and ends on the first Friday of February

Example 1: February 1st 2011 is on a tuesday so Week 1 will be from Jan 29th (Saturday) to February 4 (Friday). Week 52 of 2011 will be from Jan 21, 2012 (Saturday) to Jan 27, 2012 (Friday)

Example 2: February 1st 2014 is on a Saturday so Week 1 will be from February 1st to February 7.

I am looking for some sql or pl sql to get the week number. Any help will be greatly appreciated
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 24 2011
Added on Jan 24 2011
2 comments
3,726 views