Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4fd702

Browse files
authored
took into account that
1 parent 3bd33d1 commit f4fd702

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

source/core/coverage/proftab.sql

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
declare
22
l_tab_exist number;
33
begin
4-
select count(*) into l_tab_exist from user_tables where table_name = 'PLSQL_PROFILER_RUNS';
4+
select count(*) into l_tab_exist from
5+
(select table_name from all_tables where table_name = 'PLSQL_PROFILER_RUNS' and owner in (user,'PUBLIC')
6+
union all
7+
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_RUNS');
58
if l_tab_exist = 0 then
69
execute immediate q'[create table plsql_profiler_runs
710
(
@@ -27,7 +30,10 @@ end;
2730
declare
2831
l_tab_exist number;
2932
begin
30-
select count(*) into l_tab_exist from user_tables where table_name = 'PLSQL_PROFILER_UNITS';
33+
select count(*) into l_tab_exist from
34+
(select table_name from all_tables where table_name = 'PLSQL_PROFILER_UNITS' and owner in (user,'PUBLIC')
35+
union all
36+
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_UNITS');
3137
if l_tab_exist = 0 then
3238
execute immediate q'[create table plsql_profiler_units
3339
(
@@ -55,7 +61,10 @@ end;
5561
declare
5662
l_tab_exist number;
5763
begin
58-
select count(*) into l_tab_exist from user_tables where table_name = 'PLSQL_PROFILER_DATA';
64+
select count(*) into l_tab_exist from
65+
(select table_name from all_tables where table_name = 'PLSQL_PROFILER_DATA' and owner in (user,'PUBLIC');
66+
union all
67+
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_DATA');
5968
if l_tab_exist = 0 then
6069
execute immediate q'[create table plsql_profiler_data
6170
(
@@ -84,7 +93,10 @@ end;
8493
declare
8594
l_seq_exist number;
8695
begin
87-
select count(*) into l_seq_exist from user_sequences where sequence_name = 'PLSQL_PROFILER_RUNNUMBER';
96+
select count(*) into l_seq_exist from
97+
(select sequence_name from all_sequences where sequence_name = 'PLSQL_PROFILER_RUNNUMBER' and sequence_owner in (user,'PUBLIC');
98+
union all
99+
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_RUNNUMBER');
88100
if l_seq_exist = 0 then
89101
execute immediate q'[create sequence plsql_profiler_runnumber start with 1 nocache]';
90102
dbms_output.put_line('Sequence PLSQL_PROFILER_RUNNUMBER created');

0 commit comments

Comments
 (0)