The DECLARE Statement : Declare : Procedure Function MySQL TUTORIALS


MySQL TUTORIALS » Procedure Function » Declare »

 

The DECLARE Statement


The DECLARE statement is used to create local variables, conditions, handlers, and cursors within the procedure.

DECLARE must be the first statements immediately within a BEGIN block.

A common declaration is the local variable, which is done with a variable name and type:

DECLARE <name> <data type> [DEFAULT];

Variable declarations can use any valid data type for MySQL, and may include an optional default value.

The default value is optional when declaring a variable.

The following is an example of declaring an integer named order_tax with an initial value of 0:

DECLARE myVariable DECIMAL(10,2DEFAULT 0;



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Procedure Function
» Declare