22 l_tab_exist number ;
33begin
44 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 ' )
5+ (select table_name from all_tables where table_name = ' PLSQL_PROFILER_RUNS' and owner = sys_context( ' USERENV ' , ' CURRENT_SCHEMA ' )
66 union all
7- select synonym_name from user_synonyms where synonym_name = ' PLSQL_PROFILER_RUNS' );
7+ select synonym_name from all_synonyms where synonym_name = ' PLSQL_PROFILER_RUNS' and owner = sys_context( ' USERENV ' , ' CURRENT_SCHEMA ' ) );
88 if l_tab_exist = 0 then
99 execute immediate q' [create table plsql_profiler_runs
1010(
@@ -31,9 +31,9 @@ declare
3131 l_tab_exist number ;
3232begin
3333 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 ' )
34+ (select table_name from all_tables where table_name = ' PLSQL_PROFILER_UNITS' and owner = sys_context( ' USERENV ' , ' CURRENT_SCHEMA ' )
3535 union all
36- select synonym_name from user_synonyms where synonym_name = ' PLSQL_PROFILER_UNITS' );
36+ select synonym_name from user_synonyms where synonym_name = ' PLSQL_PROFILER_UNITS' and owner = sys_context( ' USERENV ' , ' CURRENT_SCHEMA ' ) );
3737 if l_tab_exist = 0 then
3838 execute immediate q' [create table plsql_profiler_units
3939(
@@ -62,9 +62,9 @@ declare
6262 l_tab_exist number ;
6363begin
6464 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 ' );
65+ (select table_name from all_tables where table_name = ' PLSQL_PROFILER_DATA' and owner = sys_context( ' USERENV ' , ' CURRENT_SCHEMA ' )
6666 union all
67- select synonym_name from user_synonyms where synonym_name = ' PLSQL_PROFILER_DATA' );
67+ select synonym_name from user_synonyms where synonym_name = ' PLSQL_PROFILER_DATA' and owner = sys_context( ' USERENV ' , ' CURRENT_SCHEMA ' ) );
6868 if l_tab_exist = 0 then
6969 execute immediate q' [create table plsql_profiler_data
7070(
@@ -94,9 +94,9 @@ declare
9494 l_seq_exist number ;
9595begin
9696 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 ' );
97+ (select sequence_name from all_sequences where sequence_name = ' PLSQL_PROFILER_RUNNUMBER' and sequence_owner = sys_context( ' USERENV ' , ' CURRENT_SCHEMA ' )
9898 union all
99- select synonym_name from user_synonyms where synonym_name = ' PLSQL_PROFILER_RUNNUMBER' );
99+ select synonym_name from user_synonyms where synonym_name = ' PLSQL_PROFILER_RUNNUMBER' and owner = sys_context( ' USERENV ' , ' CURRENT_SCHEMA ' ) );
100100 if l_seq_exist = 0 then
101101 execute immediate q' [create sequence plsql_profiler_runnumber start with 1 nocache]' ;
102102 dbms_output .put_line (' Sequence PLSQL_PROFILER_RUNNUMBER created' );
0 commit comments