Redeclaration or Redefinition
If you define the same variable twice in the same statement block,
you receive an error. You can redefine a variable within a nested
block, in which case it temporarily hides the outer declaration. This
example produces an error:
CREATE PROCEDURE example1()
DEFINE n INT; DEFINE j INT;
DEFINE n CHAR (1); -- redefinition produces an error
Redeclaration is valid in the following example. Within the nested
statement block, n is a character variable. Outside the block, n is
an integer variable.
CREATE PROCEDURE example2()
DEFINE n INT; DEFINE j INT;
...
BEGIN
DEFINE n CHAR (1); -- character n masks global integer variable
...
END;