Declares a variable.
The value for data-type can be any data type supported by Mimer SQL, see Data Types in SQL Statements.
The value for data-type may also be a ROW type definition. See the Mimer SQL Programmer's Manual for details of the ROW data type.
More than one variable of the same type can be declared in a single declaration.
The optional DEFAULT clause may be used to specify an initial value for the variable(s). A value of NULL is permitted as the value for the DEFAULT clause.
If a ROW data type definition has been specified for data-type, a row value expression can be specified for expression in the DEFAULT clause. See the Mimer SQL Programmer's Manual for a description of a row value expression.
If the DEFAULT clause is not specified, the variable(s) will be set to NULL initially. In the case of a variable declared with the ROW data type, each field in the variable is set to NULL initially if a DEFAULT clause is not specified.
A domain cannot be used to specify the data type in a variable declaration.
The name of a variable cannot be the same as any of the routine parameter names.
A function with MODIFIES SQL DATA specified for its access clause cannot be used as expression in the DEFAULT clause.
It is possible to declare a variable with the same name as that of a column in a table. In such a situation, an unqualified name will always resolve to the table column name and not the variable, so it is recommended that a suitable naming convention be adhered to that distinguishes between the two.
SQL/PSM EXTENDED Support for the specification of an expression rather than a literal value in the DEFAULT clause is a Mimer SQL extension.
Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40