Select row-type data
This section describes how to query data that is defined as row-type data. A ROW type is a complex type that combines one or more related data fields.
The two kinds of ROW types are as
follows:
- Named ROW type
- A named ROW type can define tables, columns, fields of another row-type column, program variables, statement local variables, and routine return values.
- Unnamed ROW type
- An unnamed ROW type can define columns, fields of another row-type column, program variables, statement local variables, routine return values, and constants.
The examples used throughout this section use
the named ROW types zip_t, address_t, and employee_t,
which define the employee table. The following figure shows
the SQL syntax that creates the ROW types and table.
The named ROW types zip_t, address_t and employee_t serve as templates for the fields and columns of the typed table, employee. A typed table is a table that is defined on a named ROW type. The employee_t type that serves as the template for the employee table uses the address_t type as the data type of the address field. The address_t type uses the zip_t type as the data type of the zip field.
The following figure shows the SQL
syntax that creates the student table. The s_address column
of the student table is defined on an unnamed ROW type. (The s_address column
could also have been defined as a named ROW type.)