-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.plsql
More file actions
78 lines (53 loc) · 3.09 KB
/
test.plsql
File metadata and controls
78 lines (53 loc) · 3.09 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
76
77
78
create or replace package test_who_am_i as -- {
procedure g;
procedure h;
procedure i;
end test_who_am_i; -- }
/
create or replace procedure test_who_am_i_proc as -- {
w call_stack.who_am_i_r;
begin
w := call_stack.who_am_i(0);
if w.pkg_name is not null then raise_application_error(-20800, 'pkg_name: ' || w.pkg_name); end if;
if w.name_ != 'TEST_WHO_AM_I_PROC' then raise_application_error(-20800, 'name: ' || w.name_ ); end if;
if w.type_ != 'PROCEDURE' then raise_application_error(-20800, 'type' ); end if;
if w.line != 5 then raise_application_error(-20800, 'line: ' || w.line ); end if;
if w.owner != user then raise_application_error(-20800, 'owner' ); end if;
end test_who_am_i_proc; -- }
/
create or replace package body test_who_am_i as -- {
procedure i is -- {
begin
h();
end i; -- }
procedure h is -- {
w call_stack.who_am_i_r;
begin
w := call_stack.who_am_i(0);
if nvl(w.pkg_name, '?') != 'TEST_WHO_AM_I' then raise_application_error(-20800, 'pkg_name: ' || w.pkg_name); end if;
if nvl(w.name_ , '?') != 'H' then raise_application_error(-20800, 'name: ' || w.name_ ); end if;
if nvl(w.type_ , '?') != 'PROCEDURE' then raise_application_error(-20800, 'type: ' || w.type_ ); end if;
if nvl(w.line , 0 ) != 12 then raise_application_error(-20800, 'line: ' || w.line ); end if;
if nvl(w.owner , '?') != user then raise_application_error(-20800, 'owner: ' || w.owner ); end if;
w := call_stack.who_am_i(1);
if nvl(w.pkg_name, '?') != 'TEST_WHO_AM_I' then raise_application_error(-20800, 'pkg_name: ' || w.pkg_name); end if;
if nvl(w.name_ , '?') != 'I' then raise_application_error(-20800, 'name: ' || w.name_); end if;
if nvl(w.type_ , '?') != 'PROCEDURE' then raise_application_error(-20800, 'type'); end if;
if nvl(w.line , 0 ) != 5 then raise_application_error(-20800, 'line: ' || w.line); end if;
if nvl(w.owner , '?') != user then raise_application_error(-20800, 'owner'); end if;
w := call_stack.who_am_i(2);
if nvl(w.pkg_name, '?') != 'TEST_WHO_AM_I' then raise_application_error(-20800, 'pkg_name: ' || w.pkg_name); end if;
if nvl(w.name_ , '?') != 'G' then raise_application_error(-20800, 'name: ' || w.name_); end if;
if nvl(w.type_ , '?') != 'PROCEDURE' then raise_application_error(-20800, 'type'); end if;
if nvl(w.line , 0 ) != 43 then raise_application_error(-20800, 'line: ' || w.line); end if;
if nvl(w.owner , '?') != user then raise_application_error(-20800, 'owner'); end if;
test_who_am_i_proc;
end h; -- }
procedure g is -- {
begin
i();
end g; -- }
end test_who_am_i; -- }
/
exec test_who_am_i.g;
select text from user_source where name = 'TEST_WHO_AM_I' and type = 'PACKAGE BODY' and line in (12, 5, 43);