Table of ContentsPreviousNext

Database Migration


Variable Declaration

This subsection describes declaration of local variables in various databases and their conversion by SQLWays.

TABLE 16. Declaration of local variables
Database
Syntax
Description
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.


Ispirer Systems
http://www.ispirer.com
ispirer@ispirer.com
Table of ContentsPreviousNext