summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/compat/oracle/r/sp-package-code.result
blob: 0dea72dba89a9fd5aafb2ba37a52ad9ee71d1853 (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
SET sql_mode=ORACLE;
CREATE PACKAGE pkg1 AS
PROCEDURE p1;
FUNCTION f1 RETURN INT;
PROCEDURE p2show;
PROCEDURE p2public;
FUNCTION f2public RETURN TEXT;
END;
$$
CREATE PACKAGE BODY pkg1 AS
a INT:=10;
PROCEDURE p1 AS
b INT:=20;
BEGIN
b:=a;
b:=a+1;
a:=b;
a:=b+1;
a:=a+1;
SET @a:=@a+2;
SELECT f1() FROM DUAL;
END;
FUNCTION f1 RETURN INT AS
BEGIN
RETURN a;
END;
PROCEDURE p2private AS
BEGIN
SELECT 'This is p2private';
END;
PROCEDURE p2public AS
BEGIN
SELECT 'This is p2public';
END;
FUNCTION f2private RETURN TEXT AS
BEGIN
RETURN 'This is f2private';
END;
FUNCTION f2public RETURN TEXT AS
BEGIN
RETURN 'This is f2public';
END;
PROCEDURE p2show AS
BEGIN
SHOW FUNCTION CODE f2public;
SHOW FUNCTION CODE f2private;
SHOW PROCEDURE CODE p2public;
SHOW PROCEDURE CODE p2private;
SHOW PROCEDURE CODE p2show;
END;
BEGIN
a:=a+1;
DECLARE
b INT;
BEGIN
b:=a;
b:=a+1;
a:=b;
a:=b+1;
END;
END;
$$
SHOW PROCEDURE CODE pkg1.p1;
Pos	Instruction
0	set b@0 20
1	set b@0 PACKAGE_BODY.a@0
2	set b@0 PACKAGE_BODY.a@0 + 1
3	set PACKAGE_BODY.a@0 b@0
4	set PACKAGE_BODY.a@0 b@0 + 1
5	set PACKAGE_BODY.a@0 PACKAGE_BODY.a@0 + 1
6	stmt 31 "SET @a:=@a+2"
7	stmt 0 "SELECT f1() FROM DUAL"
SHOW FUNCTION CODE pkg1.f1;
Pos	Instruction
0	freturn int PACKAGE_BODY.a@0
SHOW PACKAGE BODY CODE pkg1;
Pos	Instruction
0	set a@0 10
1	set a@0 a@0 + 1
2	set b@1 NULL
3	set b@1 a@0
4	set b@1 a@0 + 1
5	set a@0 b@1
6	set a@0 b@1 + 1
7	jump 11
CALL pkg1.p2show;
Pos	Instruction
0	freturn blob 'This is f2public'
Pos	Instruction
0	freturn blob 'This is f2private'
Pos	Instruction
0	stmt 0 "SELECT 'This is p2public'"
Pos	Instruction
0	stmt 0 "SELECT 'This is p2private'"
Pos	Instruction
0	stmt 110 "SHOW FUNCTION CODE f2public"
1	stmt 110 "SHOW FUNCTION CODE f2private"
2	stmt 109 "SHOW PROCEDURE CODE p2public"
3	stmt 109 "SHOW PROCEDURE CODE p2private"
4	stmt 109 "SHOW PROCEDURE CODE p2show"
DROP PACKAGE pkg1;
CREATE TABLE t1 (a INT);
CREATE PACKAGE pkg1 AS
PROCEDURE p1;
END;
$$
CREATE PACKAGE BODY pkg1 AS
a t1.a%TYPE:=10;
PROCEDURE p1 AS
b t1.a%TYPE:=20;
BEGIN
b:=a;
b:=a+1;
b:=b+1;
a:=b;
a:=b+1;
a:=a+1;
END;
BEGIN
a:=a+1;
DECLARE
b t1.a%TYPE;
BEGIN
b:=a;
b:=a+1;
a:=b;
a:=b+1;
END;
END;
$$
SHOW PROCEDURE CODE pkg1.p1;
Pos	Instruction
0	set b@0 20
1	set b@0 PACKAGE_BODY.a@0
2	set b@0 PACKAGE_BODY.a@0 + 1
3	set b@0 b@0 + 1
4	set PACKAGE_BODY.a@0 b@0
5	set PACKAGE_BODY.a@0 b@0 + 1
6	set PACKAGE_BODY.a@0 PACKAGE_BODY.a@0 + 1
SHOW PACKAGE BODY CODE pkg1;
Pos	Instruction
0	set a@0 10
1	set a@0 a@0 + 1
2	set b@1 NULL
3	set b@1 a@0
4	set b@1 a@0 + 1
5	set a@0 b@1
6	set a@0 b@1 + 1
7	jump 11
DROP PACKAGE pkg1;
DROP TABLE t1;
CREATE PACKAGE pkg1 AS
PROCEDURE p1;
END;
$$
CREATE PACKAGE BODY pkg1 AS
a ROW(a INT,b TEXT):=ROW(10,'x10');
PROCEDURE p1 AS
b ROW(a INT,b TEXT):=ROW(20,'x20');
BEGIN
b:=a;
a:=b;
b.a:=a.a+1;
a.a:=b.a+1;
a.a:=a.a+1;
END;
BEGIN
a.a:=a.a+1;
DECLARE
b ROW(a INT,b TEXT):=ROW(30,'x30');
BEGIN
b:=a;
b.a:=a.a+1;
a:=b;
a.a:=b.a+1;
END;
END;
$$
SHOW PROCEDURE CODE pkg1.p1;
Pos	Instruction
0	set b@0 (20,'x20')
1	set b@0 PACKAGE_BODY.a@0
2	set PACKAGE_BODY.a@0 b@0
3	set b.a@0[0] PACKAGE_BODY.a.a@0[0] + 1
4	set PACKAGE_BODY.a.a@0[0] b.a@0[0] + 1
5	set PACKAGE_BODY.a.a@0[0] PACKAGE_BODY.a.a@0[0] + 1
SHOW PACKAGE BODY CODE pkg1;
Pos	Instruction
0	set a@0 (10,'x10')
1	set a.a@0[0] a.a@0[0] + 1
2	set b@1 (30,'x30')
3	set b@1 a@0
4	set b.a@1[0] a.a@0[0] + 1
5	set a@0 b@1
6	set a.a@0[0] b.a@1[0] + 1
7	jump 11
DROP PACKAGE pkg1;
CREATE TABLE t1 (a INT, b TEXT);
CREATE PACKAGE pkg1 AS
PROCEDURE p1;
END;
$$
CREATE PACKAGE BODY pkg1 AS
a t1%ROWTYPE:=ROW(10,'x10');
PROCEDURE p1 AS
b t1%ROWTYPE:=ROW(20,'x20');
BEGIN
b:=a;
a:=b;
b.a:=a.a+1;
a.a:=b.a+1;
a.a:=a.a+1;
END;
BEGIN
a.a:=a.a+1;
DECLARE
b t1%ROWTYPE:=ROW(30,'x30');
BEGIN
b:=a;
b.a:=a.a+1;
a:=b;
a.a:=b.a+1;
END;
END;
$$
SHOW PROCEDURE CODE pkg1.p1;
Pos	Instruction
0	set b@0 (20,'x20')
1	set b@0 PACKAGE_BODY.a@0
2	set PACKAGE_BODY.a@0 b@0
3	set b.a@0["a"] PACKAGE_BODY.a.a@0["a"] + 1
4	set PACKAGE_BODY.a.a@0["a"] b.a@0["a"] + 1
5	set PACKAGE_BODY.a.a@0["a"] PACKAGE_BODY.a.a@0["a"] + 1
SHOW PACKAGE BODY CODE pkg1;
Pos	Instruction
0	set a@0 (10,'x10')
1	set a.a@0["a"] a.a@0["a"] + 1
2	set b@1 (30,'x30')
3	set b@1 a@0
4	set b.a@1["a"] a.a@0["a"] + 1
5	set a@0 b@1
6	set a.a@0["a"] b.a@1["a"] + 1
7	jump 11
DROP PACKAGE pkg1;
DROP TABLE t1;