Cli*_*ton 13 sql database oracle materialized-views
当我在Oracle 10g上运行以下代码时:
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
);
Run Code Online (Sandbox Code Playgroud)
尝试创建物化视图时出现此错误test4
:
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.
Run Code Online (Sandbox Code Playgroud)
我不明白"FROM子句"中的任何对象如何相互依赖.
我如何让它工作?目前我能想到的唯一工作就是test3
用普通表替换并手动删除和刷新数据.这种方法有效,但看起来有点像黑客.
或者(也许最好)我只想看一个可以有两个表的示例,并将它们连接到物化视图中,其中一个基表是批量更新的(并且不需要在物化视图中反映出来)但其他更新应反映在物化视图中(即它的"一半" fast refresh on commit
和一半complete refresh on demand
).我尝试使用refresh force
,但在使用时,EXECUTE DBMS_MVIEW.EXPLAIN_MVIEW()
我发现在提交可用时没有关于fash刷新的证据.我也想用union all
s 做这个.
归档时间: |
|
查看次数: |
2177 次 |
最近记录: |