Oracle PL/SQL Programming, 2nd Edition

Oracle PL/SQL Programming, 2nd EditionSearch this book
Previous: 20.4 Differences Between Object Views and Object TablesChapter 20
Object Views
Next: 20.6 Schema Evolution
 

20.5 Not All Views with Objects Are Object Views

With the Oracle objects option installed, there are other interesting possibilities for views which do not necessarily qualify as "object views." For example, you can create a view that has an object as a column:

CREATE TABLE requisition (
   req_no INTEGER,
   image_id NUMBER
);

CREATE VIEW requisition_v
AS
   SELECT r.req_no, VALUE(i) image
     FROM requisition r,
          images_v i
    WHERE r.image_id = i.image_id;

The requisition view now has two columns: one for the req_no, of type INTEGER; and one for the image, of type Image_t.

You can combine many object features into an object view. For instance, you can define an object view that includes a column that contains a collection of objects. Just because the possibilities seem endless, though, there is no excuse to get carried away; objects should be restricted to "natural" representations of data; they shouldn't serve merely as the basis of intellectual calisthenics for the programmer.


Previous: 20.4 Differences Between Object Views and Object TablesOracle PL/SQL Programming, 2nd EditionNext: 20.6 Schema Evolution
20.4 Differences Between Object Views and Object TablesBook Index20.6 Schema Evolution

The Oracle Library Navigation

Copyright (c) 2000 O'Reilly & Associates. All rights reserved.

Library Home Oracle PL/SQL Programming, 2nd. Ed. Guide to Oracle 8i Features Oracle Built-in Packages Advanced PL/SQL Programming with Packages Oracle Web Applications Oracle PL/SQL Language Pocket Reference Oracle PL/SQL Built-ins Pocket Reference