SQL> CREATE TABLE inventories_obj_xt
2 ORGANIZATION EXTERNAL
3 (
4 TYPE ORACLE_DATAPUMP
5 DEFAULT DIRECTORY def_dir1
6 LOCATION ('inv_obj_xt.dmp')
7 )
8 AS
9 SELECT oi.product_id,
10 DECODE (oi.warehouse, NULL, 0, 1) warehouse,
11 oi.warehouse.location_id location_id,
12 oi.warehouse.warehouse_id warehouse_id,
13 oi.warehouse.warehouse_name warehouse_name,
14 oi.quantity_on_hand
15 FROM oc_inventories oi;
Table created.
The columns in the external table containing the attributes of the object type can now be used as arguments to the type constructor function when loading a column of that type. Note that the warehouse
column in the external table is used to determine whether to call the constructor function for the object or set the column to NULL
.