【发布时间】:2018-06-16 10:12:53
【问题描述】:
我正在尝试在 Oracle 中创建 Advance Queue 表。 我为人的资产(如汽车、自行车、房子)创建了一种对象类型和表类型,为人创建了另一种对象类型(具有列名称和资产表类型)。
我需要存储具有嵌套详细信息(标题和嵌套详细信息)的有效负载。但是我在执行 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;
/
【问题讨论】:
-
您是否有迫切需要使用类型的理由?忘掉 ORDBMS 的炒作吧:Oracle 类型适用于编程构造,但不适合数据持久性。 AQ 实现倾向于使用 XML 有效负载,因为它们更简单。
标签: oracle object plsql user-defined-types oracle-aq