An object identifier
identifies the row object. In this object view, the Name column will be used as the OID.
If you have a second table that references CUSTOMER via a foreign key or primary key
relationship, you can set up an object view that contains references to CUSTOMER_OV. For example,
the CUSTOMER_CALL table contains a foreign key to the CUSTOMER table, as shown here:
create table CUSTOMER_CALL
(Name VARCHAR2(25),
Call_Number NUMBER,
Call_Date DATE,
constraint CUSTOMER_CALL_PK
primary key (Name, Call_Number),
constraint CUSTOMER_CALL_FK foreign key (Name)
references CUSTOMER(Name));
The Name column of CUSTOMER_CALL references the same column in the CUSTOMER table.
Because you have simulated OIDs (called pkOIDs) based on the primary key of CUSTOMER, you
need to create references to those OIDs. Oracle provides an operator called MAKE_REF that creates
the references (called pkREFs). In the following listing, the MAKE_REF operator is used to create
references from the object view of CUSTOMER_CALL to the object view of CUSTOMER:
create view CUSTOMER_CALL_OV as
select MAKE_REF(CUSTOMER_OV, Name) Name,
Call_Number,
Call_Date
from CUSTOMER_CALL;
Within the CUSTOMER_CALL_OV view, you tell Oracle the name of the view to reference
and the columns that constitute the pkREF. You could now query CUSTOMER_OV data from
within CUSTOMER_CALL_OV by using the DEREF operator on the Customer_ID column:
select DEREF(CCOV.
Pages:
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283