602SQL Documentation Index  

Variable Declaration

variable_declaration ::= DECLARE identifier {, identifier } [ CONSTANT | UPDATABLE ] 
    type [ DEFAULT expression ];

This statement declares variables of the specified type designated by the specified identifiers. If the DEFAULT keyword is set, variables are assigned a value of the expression by default. If the CONSTANT keyword is specified, DEFAULT must be set as well and the variable value may not be modified. If the UPDATABLE keyword is set or when neither the CONSTANT or UPDATABLE keyword is set, you can assign the variable a value (e.g. with the SET statement, UPDATE statement, or pass a variable as an OUT parameter into a routine).

The global variables of the 602SQL server are declared in the Module_globals procedure.

Variations from the SQL Standard

Example:

DECLARE err_notfound BIT DEFAULT FALSE;
DECLARE ThisValue INT; 
DECLARE ThisCompany CHAR(20) COLLATE CZ_ISO;