Expert
Q: | |
9-26. | The statements are:
|
Q: | |
9-27. | Most of the definition of the object view is quite straightforward. It gets a bit tricky when you want to include the collection. To accomplish this, you must use the CAST and MULTISET operators to transform the child relational table to a collection column: CREATE VIEW CD_object_vw
OF CD_t
WITH OBJECT OID (id)
AS
SELECT cd.id,
cd.title,
cd.artist,
cd.label,
CAST (MULTISET
(SELECT keyword
FROM cd_keywords
WHERE cd_keywords.cd_id = cd.id)
AS cd_keyword_tab_t)
FROM compact_discs cd
;And here is a query that verifies the results: SQL> SELECT artist, title, keywords FROM cd_object_vw; ARTIST TITLE KEYWORDS ---------- ... |