An Object Table


An object table is unique in that the whole table definition is of a single type. Additionally, it contains an OID (Object IDentifier) for each object. You can view this table in two ways:

  • As a single-column table, in which each row is an address_typ object, allowing you to perform OO operations.

  • As a multi-column table, in which each attribute of the object type address_typ, such as address1, city, and so on, occupies a column, allowing you to perform relational operations.
 


 SQL> CREATE TABLE  address_tab  OF  address_typ;

 Table created.

 SQL> INSERT INTO  address_tab  VALUES (
   2    address_typ('715 40th St.,', '#202J', 'Grand Forks', 'ND', '58203') );

 1 row created.

 SQL> INSERT INTO  address_tab  VALUES (
   2    'University Ave.', 'CS Dept', 'Grand Forks', 'ND', '58202' );

 1 row created.

 SQL> SELECT * FROM  address_tab a  WHERE  a.city = 'Grand Forks';

        ADDRESS1                ADDRESS2             CITY       STATE    ZIP
 ----------------------   --------------------   ------------   -----   -----
 715 40th St.,            #202J                  Grand Forks    ND      58203
 University Ave.          CS Dept                Grand Forks    ND      58202