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.

Populate one column value based on another column in Oracle

2835010Oct 30 2015 — edited Oct 30 2015

Hi Team,

I need to populate column B based on column A. Expected Column B and Explaination is given below.

Column AColumn BExpected Column BExplaination
0NULL0If column A is 0 then Column B should be 0
0NULL0
1NULL1If column A is 1 then add from previous value (1+0)
0NULL0
1NULL1If colmn A is 1 then add from previous value (1+0)
1NULL2If colmn A is 1 then add from previous value (1+1)
1NULL3If colmn A is 1 then add from previous value (1+2)
1NULL4If colmn A is 1 then add from previous value (1+3)

Request you to kindly help. Thanks in advance.

Regards,

Kashif

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 27 2015
Added on Oct 30 2015
5 comments
9,121 views