Object Tables And OID (ROW OBJECTS):
An object table is a special category of table which holds objects and gives a relational view of the attributes of that objects. In an object table, every row is a row object. Every row within the object table has an OID - an Object Identifier value - assigned through Oracle when the row is created. The OID is an identifier for a row object. The Other objects within the database can reference the rows of an object table.
Example
CREATE OR REPLACE TYPE dep_type AS OBJECT (
depno NUMBER,
dname VARCHAR2(20), loc VARCHAR2(20)
);
This is an easiest object type. To create a table out of this object type, the subsequent syntax must be used.
Syntax:
CREATE TABLE <tablename> OF <typename>;
The example which is given below shows this better.
To create an object table of the DEP_TYPE datatype,
CREATE TABLE deptab OF dep_type;
Oracle permits you to view this table in two ways:
- A single column table in that every entry is a dep_type object.
- A multi-column table in that every of the attributes of the object type dep_type, namely dname, depno,and loc occupies a column.