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!

Relative Week calculation SQL

MahakSep 22 2017 — edited Sep 22 2017

Hi All,

I have a requirement to calculate relative week number for the dates given. Requirement it outlined below.

Example: September 18th to 24th Relative Week number should be 0 and for the week past 11th to 17th should be -1 and 4th to 10th should be -2 and following weeks should be 25th to 1st should be +1 and next following week should be +2 accordingly...

I was using FLOOR(TO_CHAR(FULL_DATE,'IW')-TO_CHAR(SYSDATE,'IW')) but it will mark last year (2016) week 19th to 25th as 0 that should be the case.

can some one look into this and provide a solution?

Thanks in advance.

This post has been answered by Frank Kulash on Sep 22 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 20 2017
Added on Sep 22 2017
13 comments
1,276 views