3.3 Variable Declarations

Table of Contents Previous Next


3 Stored Procedure Language : 3.3 Variable Declarations

SPL is a block-structured language. The first section that can appear in a block is the declaration. The declaration contains the definition of variables, cursors, and other types that can be used in SPL statements contained in the block.
name type [ { := | DEFAULT } { expression | NULL } ];
name is an identifier assigned to the variable.
type is the data type assigned to the variable.
[ := expression ], if given, specifies the initial value assigned to the variable when the block is entered. If the clause is not given then the variable is initialized to the SQL NULL value.
The default value is evaluated every time the block is entered. So, for example, assigning SYSDATE to a variable of type DATE causes the variable to have the time of the current invocation, not the time when the procedure or function was precompiled.

3 Stored Procedure Language : 3.3 Variable Declarations

Table of Contents Previous Next