-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathcore.pkb
More file actions
75 lines (67 loc) · 2 KB
/
core.pkb
File metadata and controls
75 lines (67 loc) · 2 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
68
69
70
71
72
73
74
75
create or replace package body core is
procedure global_setup is
begin
ut3.ut_coverage.coverage_start_develop();
execute_autonomous(
q'[create or replace package ut_transaction_control as
function count_rows(a_val varchar2) return number;
procedure setup;
procedure test;
procedure test_failure;
end;]'
);
execute_autonomous(
q'[create or replace package body ut_transaction_control
as
function count_rows(a_val varchar2) return number is
l_cnt number;
begin
select count(*) into l_cnt from ut$test_table t where t.val = a_val;
return l_cnt;
end;
procedure setup is begin
insert into ut$test_table values ('s');
end;
procedure test is
begin
insert into ut$test_table values ('t');
end;
procedure test_failure is
begin
insert into ut$test_table values ('t');
--raise no_data_found;
raise_application_error(-20001,'Error');
end;
end;]'
);
end;
procedure global_cleanup is
begin
execute_autonomous('drop package ut_transaction_control');
end;
procedure enable_develop_coverage is
begin
ut3.ut_coverage.coverage_start_develop();
end;
procedure execute_autonomous(a_sql varchar2) is
pragma autonomous_transaction;
begin
if a_sql is not null then
execute immediate a_sql;
end if;
commit;
end;
function run_test(a_path varchar2) return clob is
l_lines ut3.ut_varchar2_list;
begin
select * bulk collect into l_lines from table(ut3.ut.run(a_path));
return ut3.ut_utils.table_to_clob(l_lines);
end;
function get_value(a_variable varchar2) return integer is
l_glob_val integer;
begin
execute immediate 'begin :l_glob_val := '||a_variable||'; end;' using out l_glob_val;
return l_glob_val;
end;
end;
/