Oracle 高级队列 - 有效负载类型问题(嵌套对象类型)



我正在尝试在Oracle中创建高级队列表。我为人员资产(如汽车、自行车、房屋(创建了一个对象类型和表类型,为人员创建了另一种对象类型(具有列名称和资产表类型(。

我需要存储具有嵌套详细信息(标头和嵌套详细信息(的有效负载。但是我在执行CREATE_QUEUE_TABLE时出现以下错误:

ORA-22913: must specify table name for nested table column or attribute
ORA-06512: at “SYS.DBMS_AQADM”, line 81
ORA-06512: at line 2

执行块:

begin
    DBMS_AQADM.CREATE_QUEUE_TABLE (
        queue_table => 'sau_q_tab'
       , queue_payload_type => 'sau_person_o_type'
    );
end;

对象类型详细信息:

CREATE OR REPLACE TYPE sau_asset_o_type as object (
    asset_id number,
    asset_name varchar2(30),
    CONSTRUCTOR FUNCTION sau_asset_o_type
        RETURN SELF AS RESULT
);
/
CREATE OR REPLACE TYPE sau_asset_t_type AS TABLE OF sau_asset_o_type;
/
CREATE OR REPLACE TYPE sau_person_o_type as object (
    person_name varchar2(30),
    person_assets sau_asset_t_type,
    CONSTRUCTOR FUNCTION sau_person_o_type /*nested table type*/
         RETURN SELF AS RESULT);
/
CREATE OR REPLACE TYPE BODY sau_person_o_type IS
    CONSTRUCTOR FUNCTION sau_person_o_type
    RETURN SELF AS RESULT IS
    BEGIN
        RETURN;
    END;
END;
/
CREATE OR REPLACE TYPE BODY sau_asset_o_type IS
    CONSTRUCTOR FUNCTION sau_asset_o_type
    RETURN SELF AS RESULT IS
    BEGIN
        RETURN;
    END;
END;
/
您需要

使用 storage_clause 参数指定嵌套表的名称。

由于队列表中对应的列称为 user_data ,我们需要使用此列名:

BEGIN
    DBMS_AQADM.CREATE_QUEUE_TABLE (
        queue_table => 'sau_q_tab'
       , queue_payload_type => 'sau_person_o_type'
       , storage_clause     => 'NESTED TABLE user_data.person_assets STORE AS sau_q_nested'
    );
END;

最新更新