Skip to content

Commit a95ca55

Browse files
committed
simplified profiler helper - no need for dynamic SQL and explicit cursor.
1 parent f4bede0 commit a95ca55

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

source/core/coverage/ut_coverage_helper_profiler.pkb

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,23 @@ create or replace package body ut_coverage_helper_profiler is
5454
end;
5555

5656
function proftab_results(a_object_owner varchar2, a_object_name varchar2, a_coverage_id integer) return t_proftab_rows is
57-
l_raw_coverage sys_refcursor;
58-
l_coverage_rows t_proftab_rows;
57+
l_coverage_rows t_proftab_rows;
5958
begin
60-
open l_raw_coverage for q'[select d.line#,
59+
select
60+
d.line#,
6161
case when sum(d.total_occur) = 0 and sum(d.total_time) > 0 then 1 else sum(d.total_occur) end total_occur
62-
from plsql_profiler_units u
63-
join plsql_profiler_data d
64-
on u.runid = d.runid
65-
and u.unit_number = d.unit_number
66-
where u.runid = :a_coverage_id
67-
and u.unit_owner = :a_object_owner
68-
and u.unit_name = :a_object_name
69-
and u.unit_type not in ('PACKAGE SPEC', 'TYPE SPEC', 'ANONYMOUS BLOCK')
70-
group by d.line#]' using a_coverage_id,a_object_owner,a_object_name;
62+
bulk collect into l_coverage_rows
63+
from plsql_profiler_units u
64+
join plsql_profiler_data d
65+
on u.runid = d.runid
66+
and u.unit_number = d.unit_number
67+
where u.runid = a_coverage_id
68+
and u.unit_owner = a_object_owner
69+
and u.unit_name = a_object_name
70+
and u.unit_type in ('PACKAGE BODY', 'TYPE BODY', 'PROCEDURE', 'FUNCTION', 'TRIGGER')
71+
group by d.line#;
7172

72-
FETCH l_raw_coverage BULK COLLECT
73-
INTO l_coverage_rows;
74-
CLOSE l_raw_coverage;
75-
76-
RETURN l_coverage_rows;
73+
return l_coverage_rows;
7774
end;
7875

7976
function get_raw_coverage_data(a_object_owner varchar2, a_object_name varchar2, a_coverage_id integer) return ut_coverage_helper.t_unit_line_calls is

0 commit comments

Comments
 (0)