blob: 0ac357df5da43a18dba6943ca6038c6224e95032 (
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
|
SET default_storage_engine=InnoDB;
SET sql_mode=ORACLE;
CREATE TABLE t1 (a INT, routine TEXT);
SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
ENGINE
InnoDB
INSERT INTO t1 VALUES (10,'none');
CREATE PACKAGE pkg1 AS
PROCEDURE p1;
END;
$$
CREATE PACKAGE BODY pkg1 AS
a INT;
PROCEDURE p1 AS
BEGIN
a:=a+1;
INSERT INTO t1 VALUES (a,'p1');
END;
BEGIN
SELECT MAX(t1.a) FROM t1 INTO a;
a:=a+1;
INSERT INTO t1 VALUES (a,'pkg1 initialization');
END;
$$
Warnings:
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
CALL pkg1.p1;
SELECT * FROM t1 ORDER BY a;
a routine
10 none
11 pkg1 initialization
12 p1
DELETE FROM t1;
# sp-cache-invalidate
START TRANSACTION;
CALL pkg1.p1;
SELECT * FROM t1 ORDER BY a;
a routine
NULL pkg1 initialization
NULL p1
ROLLBACK;
SELECT * FROM t1 ORDER BY a;
a routine
DELETE FROM t1;
# sp-cache-invalidate
INSERT INTO t1 VALUES (20,'none');
START TRANSACTION;
CALL pkg1.p1;
SELECT * FROM t1 ORDER BY a;
a routine
20 none
21 pkg1 initialization
22 p1
COMMIT;
SELECT * FROM t1 ORDER BY a;
a routine
20 none
21 pkg1 initialization
22 p1
DELETE FROM t1;
# sp-cache-invalidate
INSERT INTO t1 VALUES (20,'none');
START TRANSACTION;
CALL pkg1.p1;
SELECT * FROM t1 ORDER BY a;
a routine
20 none
21 pkg1 initialization
22 p1
ROLLBACK;
SELECT * FROM t1 ORDER BY a;
a routine
20 none
DELETE FROM t1;
DROP PACKAGE pkg1;
DROP TABLE t1;
|