Use the DECLARE statement to define a SQL variable.
This statement is allowed only inside of a stored procedure, a user-defined function, or a trigger.
The name of a variable must begin with a colon (:), both in the definition and use of the variable or parameter. A variable must be declared before it can be set to a value with SET.
Use a separate DECLARE statement for each variable (you cannot declare multiple variables with a single statement). Specify a value or values for data types that require a size, precision, or scale, such as CHAR, DECIMAL, NUMERIC, and VARCHAR.
Examples
The following examples show how to declare variables, including ones that require a value for size, precision, or scale.
DECLARE :SaleItem CHAR(15);
DECLARE :CruiseLine CHAR(25) DEFAULT 'Open Seas Tours'