CREATE TABLE TMS.TMS_OBJ_ROUTE_DATA
(
ROUTE_HEADER_COL,
ROUTE_STOPS_COL TMS.ROUTE_STOPS,
PO_COL TMS.POS,
STOP_DETAILS_COL TMS.STOP_DETAILS,
PO_STOP_DETAILS_COL TMS.PO_STOP_DETAILS,
EXPT_TEXT_COL VARCHAR2(512 BYTE),
EXPT_CODE_COL VARCHAR2(10 BYTE),
SVR_DATE_COL DATE,
DEVICE_ID_COL VARCHAR2(20 BYTE),
INSTANCEID_COL INTEGER
)
NESTED TABLE ROUTE_STOPS_COL STORE AS ROUTE_STOPS_ST,
NESTED TABLE PO_COL STORE AS POS_ST,
NESTED TABLE STOP_DETAILS_COL STORE AS STOP_DETAILS_ST,
NESTED TABLE PO_STOP_DETAILS_COL STORE AS PO_STOP_DETAILS_ST,
NESTED TABLE SETTINGS_COL STORE AS SETTINGS_ST
TABLESPACE TMSDATA
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 104K
NEXT 104K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
其中绿色的部分都是Collection types,是由Object types组成的。
具体脚本(节选PO_STOP_DETAILS,POS)如下:
CREATE OR REPLACE TYPE TMS.PO_STOP_DETAIL AS OBJECT
(
stop_detail_id INTEGER,
po_id VARCHAR(10),
stop_id INTEGER,
delete_flag CHAR(1),
sync_statuc CHAR(1)
)
/
CREATE OR REPLACE TYPE TMS.PO_STOP_DETAILS AS
TABLE OF po_stop_detail
/
CREATE OR REPLACE TYPE TMS.PO AS OBJECT
(
stop_id INTEGER,
po_id VARCHAR(10),
delete_flag CHAR(1),
weight INTEGER,
weight_uom VARCHAR(3),
sync_statuc CHAR(1)
)
/
CREATE OR REPLACE TYPE TMS.POS AS
TABLE OF po
/
VALUES (p_route_data.route_header, p_route_data.route_stops,
p_route_data.stop_pos, p_route_data.stop_details,
p_route_data.po_stop_details,
'Exception code can not be null when the status is E',
v_instance_id);