File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,7 +91,13 @@ create or replace package body ut_coverage_helper is
9191 l_tmp_data coverage_rows;
9292 l_results unit_line_calls;
9393 begin
94- select d.line#, d.total_occur
94+ select d.line#,
95+ -- This transformation addresses two issues:
96+ -- 1. dbms_profiler shows multiple unit_number for single code unit;
97+ -- to address this, we take a sum od all units by name
98+ -- 2. some lines show 0 total_occur while they were executed (time > 0)
99+ -- in this case we show 1 to indicate that there was execution even if we don't know how many there were
100+ case when sum(d.total_occur) = 0 and sum(d.total_time) > 0 then 1 else sum(d.total_occur) end total_occur
95101 bulk collect into l_tmp_data
96102 from plsql_profiler_units u
97103 join plsql_profiler_data d
@@ -101,7 +107,8 @@ create or replace package body ut_coverage_helper is
101107 and u.unit_owner = a_object_owner
102108 and u.unit_name = a_object_name
103109 --exclude specification
104- and u.unit_type not in ('PACKAGE SPEC', 'TYPE SPEC', 'ANONYMOUS BLOCK');
110+ and u.unit_type not in ('PACKAGE SPEC', 'TYPE SPEC', 'ANONYMOUS BLOCK')
111+ group by d.line#;
105112 for i in 1 .. l_tmp_data.count loop
106113 l_results(l_tmp_data(i).line) := l_tmp_data(i).calls;
107114 end loop;
You can’t perform that action at this time.
0 commit comments