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 domain
clause 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 NULL
orCHECK
constraints are not inherited. -
If the
TYPE OF COLUMN relation.column
option 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.