Local variables
Go Up to Using Variables
Local variables are declared and used within a stored procedure. They have no effect outside the procedure.
Local variables must be declared at the beginning of a procedure body before they can be used. Declare a local variable as follows:
DECLARE VARIABLE var datatype;
where <var> is the name of the local variable, unique within the procedure, and <datatype> is the data type, which can be any SQL data type except BLOB or an array. Each local variable requires a separate DECLARE VARIABLE statement, followed by a semicolon (;).
The following header declares the local variable, ANY_SALES:
CREATE PROCEDURE DELETE_EMPLOYEE (EMP_NUM INTEGER) AS DECLARE VARIABLE ANY_SALES INTEGER; BEGIN . . .