|
Oracle
|
var1 datatype [{:= | DEFAULT } exp1]
|
The DECLARE statement is used for declare variables in the declarative part of any PL/SQL block or subprogram. Declarations allocate storage space for a value, specify its data type, and name the storage location so that maybe reference it.
The keyword DEFAULT maybe used instead of the assignment operator to initialize variables.
|
|
MySQL
|
DECLARE var1 [, varN]... datatype [DEFAULT exp1]
|
The DECLARE statement is used to declare local variables.
DECLARE may only be used inside a BEGIN ... END compound statement and must be at its start, before any other statements.
The scope of a variable is within the BEGIN ... END block.
|
|
Microsoft SQL Server
|
DECLARE @var1 [AS] datatype [ , @varN [AS] datatype]
|
The DECLARE statement is used to declare variables anywhere within the procedure body, before their usage.
After declaration all variables are initialized as NULL.
|