First page Back Continue Last page Image

A Stored Procedure can declare a Variable

Just like in a Programming Language you need to Declare the variable first, this creates the storage location for that variable

DECLARE variable_name data_type [DEFAULT literal_value];

SELECT column_1[, column_2]...

INTO var1[, var2]...

SET variable_name =

{literal_value|expression};

Loading Variable with a Literal Value or an Expression

Loading Variable with Data from a Table

The code used to load the variable depends on what you want to load into it

Optional