Skip to main content

Synopsis

Description

Use the DECLARE statement directly after the begin keyword in routines to define one or more variables with an identifier as name.

Examples

A simple declaration of the variable x with the tinyint data type and the implicit default value of null:
A declaration of multiple string variables with length restricted to 25 characters:
A declaration of an exact decimal number with a default value:
A declaration with a default value from an expression:
Further examples of varying complexity that cover usage of the DECLARE statement in combination with other statements are available in the SQL routines examples documentation.

See also