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:
The examples used throughout this section use the named ROW types zip_t, address_t, and employee_t, which define the employee table. Figure 127 shows the SQL syntax that creates the ROW types and table.
CREATE ROW TYPE zip_t ( z_code CHAR(5), z_suffix CHAR(4) ) CREATE ROW TYPE address_t ( street VARCHAR(20), city VARCHAR(20), state CHAR(2), zip zip_t ) CREATE ROW TYPE employee_t ( name VARCHAR(30), address address_t, salary INTEGER ) CREATE TABLE employee OF TYPE employee_t
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.
Figure 128 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.)
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]