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

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
took into account that
  • Loading branch information
Pazus authored Jul 3, 2017
commit f4fd702b3dd325a3bb3dbc1438bedb39b16a2273
20 changes: 16 additions & 4 deletions source/core/coverage/proftab.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
declare
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still thinking if we should make scripts rerunable or drop objects on uninstall.
Also, since we modify script provided from Oracle, should we split it into one script per object?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we shouldn't drop it. Could you explain why do you want to split it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use a pattern of one script for one object so this script is the only one breaking the pattern

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but its an oracle object, not our... But I can fix it tonight

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, lets leave it as it is

l_tab_exist number;
begin
select count(*) into l_tab_exist from user_tables where table_name = 'PLSQL_PROFILER_RUNS';
select count(*) into l_tab_exist from
(select table_name from all_tables where table_name = 'PLSQL_PROFILER_RUNS' and owner in (user,'PUBLIC')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot have any table with owner = 'PUBLIC'

union all
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_RUNS');
if l_tab_exist = 0 then
execute immediate q'[create table plsql_profiler_runs
(
Expand All @@ -27,7 +30,10 @@ end;
declare
l_tab_exist number;
begin
select count(*) into l_tab_exist from user_tables where table_name = 'PLSQL_PROFILER_UNITS';
select count(*) into l_tab_exist from
(select table_name from all_tables where table_name = 'PLSQL_PROFILER_UNITS' and owner in (user,'PUBLIC')
union all
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_UNITS');
if l_tab_exist = 0 then
execute immediate q'[create table plsql_profiler_units
(
Expand Down Expand Up @@ -55,7 +61,10 @@ end;
declare
l_tab_exist number;
begin
select count(*) into l_tab_exist from user_tables where table_name = 'PLSQL_PROFILER_DATA';
select count(*) into l_tab_exist from
(select table_name from all_tables where table_name = 'PLSQL_PROFILER_DATA' and owner in (user,'PUBLIC');
Copy link
Copy Markdown
Member

@jgebal jgebal Jul 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

; at the end.

union all
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_DATA');
if l_tab_exist = 0 then
execute immediate q'[create table plsql_profiler_data
(
Expand Down Expand Up @@ -84,7 +93,10 @@ end;
declare
l_seq_exist number;
begin
select count(*) into l_seq_exist from user_sequences where sequence_name = 'PLSQL_PROFILER_RUNNUMBER';
select count(*) into l_seq_exist from
(select sequence_name from all_sequences where sequence_name = 'PLSQL_PROFILER_RUNNUMBER' and sequence_owner in (user,'PUBLIC');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

; at the end

union all
select synonym_name from user_synonyms where synonym_name = 'PLSQL_PROFILER_RUNNUMBER');
if l_seq_exist = 0 then
execute immediate q'[create sequence plsql_profiler_runnumber start with 1 nocache]';
dbms_output.put_line('Sequence PLSQL_PROFILER_RUNNUMBER created');
Expand Down