在Oracle中创建快速刷新的物化视图

时间:2016-01-01 05:20:22

标签: database oracle join materialized-views

我想创建一个物化视图,该视图应立即构建并在数据库中的每次提交时快速刷新以用于下面的内部连接查询。

示例查询格式:

CREATE MATERIALIZED VIEW test_view BUILD IMMEDIATE REFRESH FAST ON COMMIT AS
  SELECT
    INTTABLE.COLUMN1 AS "init col",
    TABLE1.COLUMN1   AS "tab1 col",
    TABLE2.COLUMN1   AS "tab2 col",
    TABLE3.COLUMN1   AS "tab3 col"
  FROM TABLE1
    INNER JOIN TABLE3
      ON TABLE1.COLUMN1 = TABLE3.COLUMN2
    INNER JOIN TABLE2
      ON TABLE2.COLUMN1 = TABLE3.COLUMN3
    INNER JOIN INTTABLE
      ON INTTABLE.COLUMN1 = TABLE2.COLUMN2;

错误消息:

Error at Command Line : 11 Column : 12
Error report -
SQL Error: ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
12054. 00000 - "cannot set the ON COMMIT refresh attribute for the materialized view"
*Cause: The materialized view did not satisfy conditions for refresh at
commit time.
*Action: Specify only valid options.

0 个答案:

没有答案