1- create table plsql_profiler_runs
1+ declare
2+ l_tab_exist number ;
3+ begin
4+ select count (* ) into l_tab_exist from
5+ (select table_name from all_tables where table_name = ' PLSQL_PROFILER_RUNS' and owner = sys_context(' USERENV' ,' CURRENT_SCHEMA' )
6+ union all
7+ select synonym_name from all_synonyms where synonym_name = ' PLSQL_PROFILER_RUNS' and owner = sys_context(' USERENV' ,' CURRENT_SCHEMA' ));
8+ if l_tab_exist = 0 then
9+ execute immediate q' [create table plsql_profiler_runs
210(
311 runid number primary key, -- unique run identifier,
412 -- from plsql_profiler_runnumber
@@ -11,12 +19,23 @@ create table plsql_profiler_runs
1119 run_system_info varchar2(2047), -- currently unused
1220 run_comment1 varchar2(2047), -- additional comment
1321 spare1 varchar2(256) -- unused
14- );
22+ )]' ;
23+ execute immediate q' [comment on table plsql_profiler_runs is
24+ ' Run- specific information for the PL/ SQL profiler' ]' ;
25+ dbms_output .put_line (' PLSQL_PROFILER_RUNS table created' );
26+ end if;
27+ end;
28+ /
1529
16- comment on table plsql_profiler_runs is
17- ' Run-specific information for the PL/SQL profiler' ;
18-
19- create table plsql_profiler_units
30+ declare
31+ l_tab_exist number ;
32+ begin
33+ select count (* ) into l_tab_exist from
34+ (select table_name from all_tables where table_name = ' PLSQL_PROFILER_UNITS' and owner = sys_context(' USERENV' ,' CURRENT_SCHEMA' )
35+ union all
36+ select synonym_name from all_synonyms where synonym_name = ' PLSQL_PROFILER_UNITS' and owner = sys_context(' USERENV' ,' CURRENT_SCHEMA' ));
37+ if l_tab_exist = 0 then
38+ execute immediate q' [create table plsql_profiler_units
2039(
2140 runid number references plsql_profiler_runs,
2241 unit_number number, -- internally generated library unit #
@@ -31,12 +50,23 @@ create table plsql_profiler_units
3150 spare2 number, -- unused
3251 --
3352 primary key (runid, unit_number)
34- );
35-
36- comment on table plsql_profiler_units is
37- ' Information about each library unit in a run' ;
53+ )]' ;
54+ execute immediate q' [comment on table plsql_profiler_units is
55+ ' Information about each library unit in a run' ]' ;
56+ dbms_output .put_line (' PLSQL_PROFILER_UNITS table created' );
57+ end if;
58+ end;
59+ /
3860
39- create table plsql_profiler_data
61+ declare
62+ l_tab_exist number ;
63+ begin
64+ select count (* ) into l_tab_exist from
65+ (select table_name from all_tables where table_name = ' PLSQL_PROFILER_DATA' and owner = sys_context(' USERENV' ,' CURRENT_SCHEMA' )
66+ union all
67+ select synonym_name from all_synonyms where synonym_name = ' PLSQL_PROFILER_DATA' and owner = sys_context(' USERENV' ,' CURRENT_SCHEMA' ));
68+ if l_tab_exist = 0 then
69+ execute immediate q' [create table plsql_profiler_data
4070(
4171 runid number, -- unique (generated) run identifier
4272 unit_number number, -- internally generated library unit #
@@ -52,10 +82,25 @@ create table plsql_profiler_data
5282 --
5383 primary key (runid, unit_number, line#),
5484 foreign key (runid, unit_number) references plsql_profiler_units
55- );
56-
57- comment on table plsql_profiler_data is
58- ' Accumulated data from all profiler runs' ;
85+ )]' ;
86+ execute immediate q' [comment on table plsql_profiler_data is
87+ ' Accumulated data from all profiler runs' ]' ;
88+ dbms_output .put_line (' PLSQL_PROFILER_DATA table created' );
89+ end if;
90+ end;
91+ /
5992
60- create sequence plsql_profiler_runnumber start with 1 nocache;
93+ declare
94+ l_seq_exist number ;
95+ begin
96+ select count (* ) into l_seq_exist from
97+ (select sequence_name from all_sequences where sequence_name = ' PLSQL_PROFILER_RUNNUMBER' and sequence_owner = sys_context(' USERENV' ,' CURRENT_SCHEMA' )
98+ union all
99+ select synonym_name from all_synonyms where synonym_name = ' PLSQL_PROFILER_RUNNUMBER' and owner = sys_context(' USERENV' ,' CURRENT_SCHEMA' ));
100+ if l_seq_exist = 0 then
101+ execute immediate q' [create sequence plsql_profiler_runnumber start with 1 nocache]' ;
102+ dbms_output .put_line (' Sequence PLSQL_PROFILER_RUNNUMBER created' );
103+ end if;
104+ end;
105+ /
61106
0 commit comments