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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Dynamic selection of monthly columns data

Rao MMar 14 2025

Hi,

We have a legacy table structure with budget_amount_month1, budget_amount_month2……budget_amount_month12.

Need to select totals based on current_month number which we know based on gl_periods table.

Ex: current month number = 3.

How to we sum data for current_month, upto_current_month.

Basically.

for current month(ex:March number 3) budget_amount_month1+budget_amount_month2+budget_amount_month3

When the query runs in April : budget_amount_month1+budget_amount_month2+budget_amount_month3+budget_amount_month4.

We know the month number.

Please advise dynamic addition of the columns.. which have month number as last characters of the column name.

thanks

This post has been answered by Frank Kulash on Mar 14 2025
Jump to Answer

Comments

Processing

Post Details

Added on Mar 14 2025
3 comments
120 views