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!

PLSQL aggegations with addition and Subtraction

srivMar 27 2019 — edited Mar 27 2019

Hi All,

I have below input table with members in Parent/Child format with aggregation and data present at Level-0 members.

Can some one help with PL/SQL code to aggregate data to the upper level members based on the aggregation symbol for each row.

Input Table:

   

ParentChildLevelAggregationData
TopACC2+
ACCACC11+
ACC1ACC1_10+400
ACC1ACC1_20+350
ACC1ACC1_30-150
ACCACC21-
ACC2ACC2_10+50
ACC2ACC2_20+150

Output Table:

   

ParentChildLevelAggregationData
TopACC2+400
ACCACC11+600
ACC1ACC1_10+400
ACC1ACC1_20+350
ACC1ACC1_30-150
ACCACC21-200
ACC2ACC2_10+50
ACC2ACC2_20+

150

Comments
Post Details
Added on Mar 27 2019
3 comments
282 views