创建摘要 table 违反了限制

Creating a summary table violates a restriction

我正在尝试联合包含在一个 MQT 中的两个 MQT。

CREATE SUMMARY TABLE MYUNIONEDTABLE 
    AS (
    SELECT * FROM MQT1
    UNION ALL 
    SELECT * FROM MQT2
    )
    DATA INITIALLY DEFERRED REFRESH DEFERRED
    ORGANIZE BY ROW;

这会导致以下错误:

The statement failed because the fullselect specified for the materialized query table "MYUNIONEDTABLE" violates a restriction. Reason code = "2".. SQLCODE=-20058, SQLSTATE=428EC, DRIVER=4.18.60

SELECT 语句本身工作正常。

你检查过这个错误的 Info Center article 了吗?

SQL20058N

The statement failed because the fullselect specified for the materialized query table table-name violates a restriction. Reason code = reason-code.

Explanation

Restrictions apply to the contents of a fullselect used in the definition of a materialized query table. Some restrictions are based on the materialized query table options, such as REFRESH DEFERRED or REFRESH IMMEDIATE. Other restrictions are based on whether or not the table is replicated. The fullselect in the statement that returned this condition violates at least one of these restrictions.

If this message is returned during the creation of a staging table, the error applies to the query used in the definition of the materialized query table with which the staging table is associated.

如您的错误消息所示,原因代码 2 表示:

The fullselect referenced an unsupported object type.

查看 article for MQT restrictions 以了解您使用的是不受支持的语句。