【发布时间】:2016-01-22 10:38:51
【问题描述】:
我需要将作为主键一部分的列的唯一值从表中提取到物化视图中。如果使用“刷新完成”,我可以创建物化视图,但在尝试使用“提交时快速刷新”时没有运气。谁能指出我是否遗漏了什么或 Oracle 不支持此类操作。
示例输出如下所示。谢谢。
SQL> create table TEST( col1 number, col2 number, col3 varchar(32), CONSTRAINT test_pk Primary Key (col1, col2));
Table created.
SQL> create materialized view test_mv build immediate refresh fast on commit as select distinct col2 from test;
create materialized view test_mv build immediate refresh fast on commit as select distinct col2 from test
*
ERROR at line 1:
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
SQL> create materialized view test_mv build immediate refresh complete as select distinct col2 from test;
Materialized view created.
SQL> drop materialized view test_mv;
Materialized view dropped.
SQL> create materialized view log on test;
Materialized view log created.
SQL> create materialized view test_mv build immediate refresh fast on commit as select distinct col2 from test;
create materialized view test_mv build immediate refresh fast on commit as select distinct col2 from test
*
ERROR at line 1:
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
【问题讨论】:
标签: oracle primary-key materialized-views