1

Is it possible to automatically populate a nested table through a query? Maybe through a materialised view? Like f.e

CREATE OR REPLACE TYPE also_bought_type AS OBJECT (
also_bought_movie REF MOVIE_TYPE)
/
CREATE OR REPLACE TYPE also_bought_tab_type
AS TABLE OF also_bought_type
/
CREATE OR REPLACE TYPE movie_type AS OBJECT (
title   VARCHAR2(64),
also_bought    also_bought_tab_type)
/
create table movie of movie_type 
object id system generated
/

Now also_bought_type (the nested table) should be populated from a secondary table:

create or replace TYPE purchases_type as object
(
movie_1 REF MOVIE_TYPE,
movie_2 REF MOVIE_TYPE,
purchases number
)
/
create table purchases of purchases_type
object id system generated
/

using a query that checks with what other movie that movie was purchased.

APC
  • 144,005
  • 19
  • 170
  • 281
bicycle
  • 8,315
  • 9
  • 52
  • 72
  • 1
    There's a nasty circularity in your object model: `also_bought_type`<-`also_bought_type_tab`<-`movie_type`<-`also_bought_type`<-`. I think this is symptomatic of some confused business logic. I know some OO implementations are okay with circular referencing but Oracle's Types work best if we stick to a hierarchy. – APC Oct 23 '12 at 10:10

0 Answers0