Hello
Here's first the model
create table tbl (name varchar2(50), value varchar2(10), status varchar2(2));
insert into tbl values ('sql', 'TRUE' ,'ko');
insert into tbl values ('plsql', 'TRUE' ,'ko');
insert into tbl values ('foo', '21.1.0' ,'ok');
insert into tbl values ('bar', '0' , 'ok');
insert into tbl values ('toto', '100' ,'ok');
insert into tbl values ('titi', 'ROWS','ok');
insert into tbl values ('c#', 'on','ok');
insert into tbl values ('java', 'TRUE','ok');
insert into tbl values ('python','0','ok');
insert into tbl values ('perl' ,'FALSE','ko');
insert into tbl values ('regexp' ,'MANUAL','ok');
commit:
SQL> select * from tbl order by status;
NAME VALUE ST
-------------------------------------------------- ---------- --
perl FALSE ko
sql TRUE ko
plsql TRUE ko
regexp MANUAL ok
c# on ok
java TRUE ok
python 0 ok
toto 100 ok
bar 0 ok
foo 21.1.0 ok
titi ROWS ok
11 rows selected.
And now the expected results
NAME VALUE ST %compliance %Uncompliance
------------------- ---------- --- ------------ -------------
perl FALSE ko 73% 27%
sql TRUE ko
plsql TRUE ko
regexp MANUAL ok
c# on ok
java TRUE ok
python 0 ok
toto 100 ok
bar 0 ok
foo 21.1.0 ok
titi ROWS ok
11 rows selected.
The two wanted extra columns are computed as follows
%compliance = sum(ok)/total rows = 8/11 = 73%
%Uncompliance = sum(ko)/total rows = 3/11 = 27%
Thanks in advance
Mohamed