Example: Variable declarations of anchored data types
Examples of anchored data type declarations can be useful references when declaring variables.
The following is an example of a declaration of a variable named v1 that
has the same data type as the column name in table staff:
DECLARE v1 ANCHOR DATA TYPE TO staff.name;
The following is an example of a CREATE TYPE statement that defines
a type named empRow1 that is anchored to a row defined in
a table named employee:
CREATE TYPE empRow1 AS ROW ANCHOR DATA TYPE TO ROW OF employee;
For
variables declared of type empRow1, the field names are the
same as the table column names.If the data type of the column name is VARCHAR(128), then the variable v1 will also be of data type VARCHAR(128).