当我上运行的Oracle 10g以下代码:甲骨文物化视图错误:代码中包含了
SQL Error: ORA-12053: this is not a valid nested materialized view
12053. 00000 - "this is not a valid nested materialized view"
*Cause: The list of objects in the FROM clause of the definition of this
materialized view had some dependencies upon each other.
*Action: Refer to the documentation to see which types of nesting are valid.
我不”:
drop materialized view test4;
drop materialized view test3;
drop table test2;
drop table test1;
create table test1
(
x1 varchar2(1000),
constraint test1_pk primary key (x1)
);
create materialized view log on test1 with sequence;
create table test2
(
x2 varchar2(1000),
constraint test2_pk primary key (x2)
);
create materialized view log on test2 with sequence;
create materialized view test3
refresh complete on demand
as
(
select x1 from test1
union all
select null from dual where 0 = 1
);
alter table test3 add constraint test3_pk primary key (x1);
create materialized view log on test3 with sequence;
create materialized view test4
refresh fast on commit
as
(
select t1.rowid as rid1, t2.rowid as rid2, t1.x1 u1, t2.x2
from test3 t1, test2 t2
where t1.x1 = t2.x2
);
我在试图创建物化视图test4
得到这个错误了解“FROM子句”中的任何对象如何相互依赖。
我如何得到这个工作?目前我能想到的唯一工作是用普通表替换test3
并手动删除和刷新数据。这种方法很有效,但似乎有点破解。
或者(也许最好)我只想看一个可以有两个表的例子,并将它们连接到一个物化视图中,其中一个基表被批量更新(并且不需要反映在物化视图中),但其他更新应反映在物化视图中(即它是“一半”fast refresh on commit
,和一半complete refresh on demand
)。我尝试使用refresh force
,但是当使用EXECUTE DBMS_MVIEW.EXPLAIN_MVIEW()
时,我发现没有可用的提交刷新刷新的证据。我也想用union all
来做到这一点。
+1更好的解释和现在ilustrated :) –
'test3'没有太大的意义:'从0选择零对0 = 1'将永远不会返回一行。 – Allan
@Allan:这是一个黑客,使其成为一个聚合。如果它停止了错误,请随时删除它。 – Clinton