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!

Columns calculated from other columns

happy10319Mar 10 2019 — edited Mar 11 2019

Hi,

This is my table:

create table testbis (id NUMBER , action char(2),status char(2),nra int NULL,list_se varchar2(50)NULL);

insert into testbis (id,action,status) values (0,'t0','p');

insert into testbis (id,action,status) values (1,'SE','VS');

insert into testbis (id,action,status) values (2,'RA','p');

insert into testbis (id,action,status) values (3,'SE','VS');

insert into testbis (id,action,status) values (4,'SE','VS');

insert into testbis (id,action,status) values (5,'RA','P');

insert into testbis (id,action,status) values (6,'RA','P')

pastedImage_0.png

How can I have (calculate) the count of rows with action=RA and ID > than last previous SE in NRA column and concatanation of IDs of all previous SE rows in LIST_SE column of each RA row?

Hope be clear enough.

For example:

pastedImage_1.png

Thanks.

This post has been answered by Frank Kulash on Mar 10 2019
Jump to Answer
Comments
Post Details
Added on Mar 10 2019
6 comments
134 views