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.