-
Notifications
You must be signed in to change notification settings - Fork 188
Expand file tree
/
Copy pathdbms_plssqlcode.sql
More file actions
67 lines (67 loc) · 3.16 KB
/
dbms_plssqlcode.sql
File metadata and controls
67 lines (67 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
declare
l_tab_exist number;
begin
select count(*) into l_tab_exist from
(select table_name from all_tables where table_name = 'DBMSPCC_BLOCKS' and owner = sys_context('USERENV','CURRENT_SCHEMA')
union all
select synonym_name from all_synonyms where synonym_name = 'DBMSPCC_BLOCKS' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
if l_tab_exist = 0 then
execute immediate q'[
create table dbmspcc_blocks (
run_id number(38, 0),
object_id number(38, 0),
block number(38, 0),
line number(38, 0) constraint dbmspcc_blocks_line_nn not null enable,
col number(38, 0) constraint dbmspcc_blocks_col_nn not null enable,
covered number(1, 0) constraint dbmspcc_blocks_covered_nn not null enable,
not_feasible number(1, 0) constraint dbmspcc_blocks_not_feasible_nn not null enable,
constraint dbmspcc_blocks_block_ck check ( block >= 0 ) enable,
constraint dbmspcc_blocks_line_ck check ( line >= 0 ) enable,
constraint dbmspcc_blocks_col_ck check ( col >= 0 ) enable,
constraint dbmspcc_blocks_covered_ck check ( covered in ( 0, 1 ) ) enable,
constraint dbmspcc_blocks_not_feasible_ck check ( not_feasible in ( 0, 1 ) ) enable,
constraint dbmspcc_blocks_pk primary key ( run_id, object_id, block ) using index
)]';
end if;
end;
/
declare
l_tab_exist number;
begin
select count(*) into l_tab_exist from
(select table_name from all_tables where table_name = 'DBMSPCC_RUNS' and owner = sys_context('USERENV','CURRENT_SCHEMA')
union all
select synonym_name from all_synonyms where synonym_name = 'DBMSPCC_RUNS' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
if l_tab_exist = 0 then
execute immediate q'[
create table dbmspcc_runs (
run_id number(38, 0),
run_comment varchar2(4000 byte),
run_owner varchar2(128 byte) constraint dbmspcc_runs_run_owner_nn not null enable,
run_timestamp date constraint dbmspcc_runs_run_timestamp_nn not null enable,
constraint dbmspcc_runs_pk primary key ( run_id ) using index enable
)]';
end if;
end;
/
declare
l_tab_exist number;
begin
select count(*) into l_tab_exist from
(select table_name from all_tables where table_name = 'DBMSPCC_UNITS' and owner = sys_context('USERENV','CURRENT_SCHEMA')
union all
select synonym_name from all_synonyms where synonym_name = 'DBMSPCC_UNITS' and owner = sys_context('USERENV','CURRENT_SCHEMA'));
if l_tab_exist = 0 then
execute immediate q'[
create table dbmspcc_units (
run_id number(38, 0),
object_id number(38, 0),
owner varchar2(128 byte) constraint dbmspcc_units_owner_nn not null enable,
name varchar2(128 byte) constraint dbmspcc_units_name_nn not null enable,
type varchar2(12 byte) constraint dbmspcc_units_type_nn not null enable,
last_ddl_time date constraint dbmspcc_units_last_ddl_time_nn not null enable,
constraint dbmspcc_units_pk primary key ( run_id, object_id ) using index enable
)]';
end if;
end;
/