Data Type for Variables
A local variable can be of any SQL type other than an array.
-
A domain name can be specified as the type;the variable will inherit all of its attributes.
-
If the
TYPE OF domainclause is used instead, the variable will inherit only the domain’s data type, and, if applicable, its character set and collation attributes.Any default value or constraints such asNOT NULLorCHECKconstraints are not inherited. -
If the
TYPE OF COLUMN relation.columnoption is used to “borrow” from a column in a table or view, the variable will inherit only the column’s data type, and, if applicable, its character set and collation attributes.Any other attributes are ignored.