16 Create an Object Relational Database

How do I…

16.1 Create object types and use them in relational tables?

16.2 Use constructor methods to populate object relational tables?

16.3 Create and use object tables?

16.4 Create and use the VARRAY collection type?

16.5 Create and use the nested table collection type?

16.6 Create and use object views?

16.7 Issue DML commands on object views and use INSTEAD OF triggers?

16.8 Use MAP and ORDER methods to compare objects?

Oracle Corporation has chosen not to abandon its relational database roots with the release of Oracle8. Accordingly, this new version of the database is not purely object-oriented. It still supports all the relational technology that has become an integral part of many organizations’ database environments. Object extensions, however, comprise one of the most exciting enhancements to the Oracle database under Oracle8. An object relational database is a fusion of relational and object-oriented technologies and enables users to gradually integrate object technology with existing relational applications. Developers can use objects in relational tables, create pure object tables, and define object views to allow object-oriented navigation of existing relational structures under the Oracle8 umbrella.

16.1 Create Object Types and Use Them in Relational Tables

The easiest way for relational database users to become familiar with object-oriented database technology is to draw parallels between database objects and standard relational database tables. In some ways, these entities are not that different. This How-To explains creation of object types and their inclusion in relational table definitions.

16.2 Use Constructor Methods to Populate Object Relational Tables

The SQL syntax for populating tables containing object columns is also new in Oracle8. This How-To introduces the concept of a method and shows how to use a particular type of method, called a constructor method, to insert data into object-enabled relational tables.

16.3 Create and Use Object Tables

How-To 16.1 showed how to integrate object types and relational table definitions. Object tables, the subject of this section, are one step closer to pure object-oriented constructions. This How-To defines object tables and discusses how to use them to enforce the foreign key relationships common to relational database designs.

16.4 Create and Use the VARRAY Collection Type

Collection types have played a major role in object-oriented languages for some time and Oracle8 offers an ordered collection type through the VARRAY datatype. Definition and use of VARRAYs are the subjects of this How-To.

16.5 Create and Use the Nested Table Collection Type

Nested tables are another collection type supported in Oracle8. Like VARRAYs, they can help model one-to-many relationships without the overhead associated with traditional joins. This How-To focuses on the definition and use of nested tables.

16.6 Create and Use Object Views

Object views provide a way to impose an object structure over a relational database design without disturbing legacy applications. They provide a low-risk migration path to object-oriented architectures. This How-To describes creating an object view of some familiar sample database tables.

16.7 Issue DML Commands on Object Views and Use INSTEAD OF Triggers

This How-To explains extracting and inserting data into underlying relational tables using object views. SELECT syntax is straightforward, but INSERT statements on object views featuring joins may require use of a new Oracle8 feature, the INSTEAD OF trigger.

This new capability also enhances the usefulness of a feature first found in Oracle 7.3: updatable join views. These database entities had some limitations arising from the inherent ambiguity of update operations on joined tables. INSTEAD OF triggers address these limitations for updatable join views and for updatable object views. This How-To discusses construction of an INSTEAD OF trigger to increase the update flexibility of the object view from the previous section.

16.8 Use MAP and ORDER Methods to Compare Objects

Many common database functions, including indexing, sorting, and joining require Oracle8 to compare database objects. The results of these comparisons are obvious when the values Oracle8 must compare are traditional scalar quantities. Users and developers need to instruct Oracle8, however, about how to compare database objects. This How-To introduces member methods and explains definition and use of MAP and ORDER methods in particular.