summaryrefslogtreecommitdiff
path: root/mysql-test/suite/compat/oracle/t/variables.test
blob: 4705cac11c00fa28ba99db7194dd33e77d1071a6 (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
SET sql_mode=oracle;

--echo #
--echo # MDEV-10411 Providing compatibility for basic PL/SQL constructs
--echo # Part 6: Assignment operator
--echo #

max_sort_length:=1030;
SELECT @@max_sort_length;
max_sort_length:=DEFAULT;

--echo #
--echo # Testing that SP variables shadow global variables in assignments
--echo #

DELIMITER $$;
CREATE PROCEDURE p1
AS
BEGIN
  max_sort_length:=1030;
  DECLARE
    max_sort_length INT DEFAULT 1031;
  BEGIN
    SELECT @@max_sort_length, max_sort_length;
    max_sort_length:=1032;
    SELECT @@max_sort_length, max_sort_length;
  END;
  SELECT @@max_sort_length;
  max_sort_length:= DEFAULT;
END;
$$
DELIMITER ;$$
CALL p1();
DROP PROCEDURE p1;

--echo #
--echo # End of MDEV-10411 Providing compatibility for basic PL/SQL constructs (part 6)
--echo #