-
Notifications
You must be signed in to change notification settings - Fork 188
Expand file tree
/
Copy pathsimple_example.sql
More file actions
74 lines (57 loc) · 1.28 KB
/
simple_example.sql
File metadata and controls
74 lines (57 loc) · 1.28 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
create or replace package SIMPLE_EXAMPLE
as
procedure DOUBLE_IT(V IN number,W OUT number);
function TRIPLE_IT(Y IN number) return number;
end SIMPLE_EXAMPLE;
/
create or replace package body SIMPLE_EXAMPLE
as
procedure DOUBLE_IT(V IN number,W OUT number)
IS
BEGIN
W := 2*V;
END DOUBLE_IT;
function TRIPLE_IT(Y IN number) return number
IS
BEGIN
RETURN 3*Y;
END TRIPLE_IT;
end SIMPLE_EXAMPLE;
/
create or replace package UT_SIMPLE_EXAMPLE
as
procedure UT_SETUP;
procedure UT_TEARDOWN;
procedure UT_DOUBLE_IT;
procedure UT_TRIPLE_IT;
end UT_SIMPLE_EXAMPLE;
/
create or replace package body UT_SIMPLE_EXAMPLE
as
procedure UT_SETUP
IS
BEGIN
NULL;
END UT_SETUP;
procedure UT_TEARDOWN
IS
BEGIN
NULL;
END UT_TEARDOWN;
procedure UT_DOUBLE_IT
IS
A NUMBER;
BEGIN
SIMPLE_EXAMPLE.DOUBLE_IT(NULL, A);
utAssert.isnull('Null value', A);
SIMPLE_EXAMPLE.DOUBLE_IT(1, A);
utAssert.eq('Typical value', A, 2);
END UT_DOUBLE_IT;
procedure UT_TRIPLE_IT
IS
BEGIN
utAssert.isnull('Null value', SIMPLE_EXAMPLE.TRIPLE_IT(null));
utAssert.eq('Typical value', SIMPLE_EXAMPLE.TRIPLE_IT(1), 3);
END UT_TRIPLE_IT;
end UT_SIMPLE_EXAMPLE;
/