DECLARE 语句用于定义程序本地的各种项:The DECLARE statement is used to
define various items local to a program:
局部变量。参见 第 15.6.4 节,”存储程序中的变量“。Local variables. See Section 15.6.4, “Variables in Stored Programs”.
条件与处理器。参见 第 15.6.7 节,“条件处理”。Conditions and handlers. See Section 15.6.7, “Condition Handling”.
光标。参见 第 15.6.6 节,“Cursors”。Cursors. See Section 15.6.6, “Cursors”.
DECLARE 仅允许在 BEGIN ... END 复合语句,必须置于开头,排在其他语句之前。DECLARE is permitted only inside a
BEGIN ... END
compound statement and must be at its start, before any other
statements.
声明必须遵循一定顺序。光标声明必须出现在处理程序声明之前。变量和条件声明必须出现在光标或处理程序声明之前。Declarations must follow a certain order. Cursor declarations must appear before handler declarations. Variable and condition declarations must appear before cursor or handler declarations.