Skip to Main Content

SQL Developer

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!

Query to get 7 days prior to current_date in next month and calculate recursively for all the months of the year

Chandu VenuAug 25 2023

Hello,

Create TABLE T1_TEMP(Start_date DATE, Month_Number NUMBER, YEAR_Number NUMBER);
Insert into T1_TEMP VALUES (to_date('08/25/2023', 'mm/dd/yyyy'),8,2023);

When I query the above table, I get:

I am trying to get something like this for the upcoming months:

So, beginning from a start_date in August, I am trying to get an output that gives me dates for upcoming months, that is 7 days prior to the start_date in previous month.

Please let me know if you need any further details.

Any help is greatly appreciated.

Thanks

This post has been answered by Solomon Yakobson on Aug 25 2023
Jump to Answer
Comments
Post Details
Added on Aug 25 2023
8 comments
177 views