explored the performance implications of the exciting new object-oriented features that were introduced in Oracle.
The main points of this module include:
- You can now define your own data types and define columns that participate in these data types.
- Some of the new object-oriented Oracle features include ADTs, OIDs, nested tables,
- Oracle now provides for nested tables, where a column can point to a number a row of a subordinate table.
- Oracle now has Object IDs (OIDs). These uniquely identify Oracle rows, and they will never change, even if the row is relocated.
Here are some terms that may be new to you:
- Object ID:A unique identifier for an object.
- Pointer: A variable or reference that holds address information and points or refers to a location (usually in another table).
- VARRAY:Is a repeating group that allows us to dramatically improve the performance of Oracle queries, because subordinate tables are no longer required in order to represent a one-to-many relationship.
The next module discusses using the Oracle Dictionary to monitor performance.
In an object table, each row is a row object. An object table differs from a normal relational table in several ways.
- First, each row within the object table has an OID, an object identifier value assigned by Oracle when the row is created.
- Second, the rows of an object table can be referenced by other objects within the database.
You can create an object table via the create table command. Consider the ANIMAL_TY datatype shown in previous chapters.
To avoid conflicts with objects created during earlier chapters, create this type in a new schema:
create or replace type ANIMAL_TY as object
To keep this example simple, the ANIMAL_TY datatype is created without any member functions.
To create an object table of the ANIMAL_TY datatype, issue the following create table command:
create table ANIMAL of ANIMAL_TY;
Note that the command has an unusual syntax, creating the table of an object type. The resulting table may first appear to be a normal relational table:
The ANIMAL table's columns map to the attributes of the ANIMAL_TY object type. However, there are significant differences in how you can use the table, since it is an object table.
As noted earlier in this section, each row within the object table will have an OID value, and the rows can be referenced as objects.