通过查询填充的Oracle嵌套表

时间:2012-10-23 04:28:49

标签: oracle user-defined-types nested-table

是否可以通过查询自动填充嵌套表?也许通过物化观点?像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
/

现在应该从辅助表中填充all_bought_type(嵌套表):

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
/

使用查询来检查购买该电影的其他电影。

0 个答案:

没有答案