Convert an untyped table into a typed table

If you want to convert an existing untyped table into a typed table, you can use the ALTER TABLE statement. For example, consider the following untyped table:
CREATE TABLE manager
(
   name        VARCHAR(30),
   department  VARCHAR(20),
   salary      INTEGER
);
To convert an untyped table to a typed table, both the field names and the field types of the named row type must match the column names and column types of the existing table. For example, to make the manager table a typed table, you must first create a named row type that matches the column definitions of the table. The following statement creates the manager_t type, which contains field names and field types that match the columns of the manager table:
CREATE ROW TYPE manager_t
(
   name        VARCHAR(30),
   department  VARCHAR(20),
   salary      INTEGER
);
After you create the named row type that you want to assign to the existing untyped table, use the ALTER TABLE statement to assign the type to the table. The following statement alters the manager table and makes it a typed table of type manager_t:
ALTER TABLE manager ADD TYPE manager_t

The new manager table contains the same columns and data types as the old table but now provides the advantages of a typed table.