當我上運行的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