无法使用“on statements”子句创建物化视图

问题描述 投票:0回答:1

在使用 on 语句创建物化视图时,出现以下错误。

ORA-32428: on-statement materialized join view error: Shape of MV is not supported 32428. 0000 -  "on-statement materialized join view error: %s" *Cause:    An error related to on-statement materialized join view was received. *Action:   Refer to the error message for more information.

我使用的是oracle版本21c

这就是我所做的

CREATE TABLE "TBL1" (
 "COL1" VARCHAR2(20 BYTE),
 "COL2" VARCHAR2(20 BYTE),
 "COL3" VARCHAR2(20 BYTE),
 "COL4" NUMBER
;

create MATERIALIZED view log on tbl1 with rowid;

create materialized view mv3
build DEFERRED
refresh fast with rowid
on statement
enable query rewrite
as
select rowid rid, COL1,COL2 from tbl1;
oracle materialized-views oracle21c
1个回答
0
投票

来自文档

“物化视图的定义查询中引用的基表必须在使用星型模式或雪花模式模型的连接图中连接。查询必须恰好包含一个集中式事实表和一个或多个维度表,并且所有对的连接使用主键-外键约束关联的表。”

例如

SQL> create table par ( p int primary key, d date);

Table created.

SQL> create table chd ( c int primary key, p int references par (p), d1 date);

Table created.

SQL>
SQL> create materialized view log on par with rowid;

Materialized view log created.

SQL> create materialized view log on chd with rowid;

Materialized view log created.

SQL>
SQL> create materialized view mv3
  2  refresh fast with rowid
  3  on statement
  4  enable query rewrite
  5  as
  6  select c.rowid rid, p.p, p.d, c.c, c.d1
  7  from par p, chd c
  8  where p.p = c.p;

Materialized view created.
© www.soinside.com 2019 - 2024. All rights reserved.