Also, you can
use where clauses in the query that forms the basis of the object view. You can therefore limit the
rows that are accessible via the object view.
If you use object views, you as the DBA will administer relational tables the same way as you
did before. You will still need to manage the privileges for the datatypes (see the following section
of this chapter for information on security management of abstract datatypes), but the table and
index structures will be the same as they were before the creation of the abstract datatypes. Using
the relational structures will simplify your administration tasks while allowing developers to access
objects via the object views of the tables.
You can also use object views to simulate the references used by row objects. Row objects are
rows within an object table. To create an object view that supports row objects, you need to first
create a datatype that has the same structure as the table, as shown here:
Chapter 5: Developing and Implementing Applications 153
create or replace type CUSTOMER_TY as object
(Name VARCHAR2(25),
Street VARCHAR2(50),
City VARCHAR2(25),
State CHAR(2),
Zip NUMBER);
Next, create an object view based on the CUSTOMER_TY type while assigning object
identifier, or OID, values to the rows in CUSTOMER:
create view CUSTOMER_OV of CUSTOMER_TY
with object identifier (Name) as
select Name, Street, City, State, Zip
from CUSTOMER;
The first part of this create view command gives the view its name (CUSTOMER_OV) and tells
Oracle that the view??™s structure is based on the CUSTOMER_TY datatype.
Pages:
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282