8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

ORA-12054:无法使用简单连接在提交时创建 Oracle MV 刷新

coder rock 3月前

27 0

在创建提交时刷新 MV 时,我可以让它与一个连接一起工作,但与两个连接一起工作时会失败。我想这与密钥保留有关,但我看不出是怎么回事。我试过 DBMS_MVIEW.EXPLAIN_M...

在创建提交时刷新 MV 时,我可以让它与一个连接一起工作,但与两个连接一起工作时会失败。我想这与密钥保留有关,但我看不出是怎么回事。我试过了, DBMS_MVIEW.EXPLAIN_MVIEW 但它给了我 ORA-32342: The EXPLAIN_MVIEW facility failed to explain the materialized view statement


CREATE TABLE TMP_20240730_171526_B
(
    ID INT PRIMARY KEY
);
CREATE TABLE TMP_20240730_171526_C
(
    ID INT PRIMARY KEY
);
CREATE TABLE TMP_20240730_171526_A
(
    ID   INT PRIMARY KEY,
    B_ID INT
        CONSTRAINT TMP_20240730_171526_A_B_FK REFERENCES TMP_20240730_171526_B,
    C_ID INT
        CONSTRAINT TMP_20240730_171526_A_C_FK REFERENCES TMP_20240730_171526_C
);


-- this works
CREATE MATERIALIZED VIEW TMP_20240730_171749_MV REFRESH COMPLETE ON COMMIT
AS
SELECT A.ID A_ID, B.ID B_ID
FROM TMP_20240730_171526_A A
         JOIN TMP_20240730_171526_B B ON A.B_ID = B.ID;
DROP MATERIALIZED VIEW TMP_20240730_171749_MV;

-- this fails: ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
CREATE MATERIALIZED VIEW TMP_20240730_171749_MV REFRESH COMPLETE ON COMMIT
AS
SELECT A.ID A_ID, B.ID B_ID
FROM TMP_20240730_171526_A A
         JOIN TMP_20240730_171526_B B ON A.B_ID = B.ID
         JOIN TMP_20240730_171526_C C ON A.C_ID = C.ID
;

-- clean up
-- DROP MATERIALIZED VIEW TMP_20240730_171749_MV;
DROP TABLE TMP_20240730_171526_A;
DROP TABLE TMP_20240730_171526_B;
DROP TABLE TMP_20240730_171526_C;
帖子版权声明 1、本帖标题:ORA-12054:无法使用简单连接在提交时创建 Oracle MV 刷新
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由coder rock在本站《oracle》版块原创发布, 转载请注明出处!
最新回复 (0)
  • 旧式 JOIN:

    CREATE MATERIALIZED VIEW TMP_20240730_171749_MV REFRESH COMPLETE ON COMMIT
    AS
    SELECT A.ID A_ID, B.ID B_ID
    FROM TMP_20240730_171526_A A
    ,TMP_20240730_171526_B B 
    ,TMP_20240730_171526_C C 
    WHERE A.B_ID = B.ID AND A.C_ID = C.ID
    ;
    
返回
作者最近主题: