30.5 INSERT_GEOM_METADATA Procedure

This procedure inserts a spatial metadata record and optionally creates a spatial index.

Syntax

APEX_SPATIAL.INSERT_GEOM_METADATA (
    p_table_name        IN VARCHAR2,
    p_column_name       IN VARCHAR2,
    p_diminfo           in mdsys.sdo_dim_array,
    p_srid              in t_srid,
    p_create_index_name IN VARCHAR2 DEFAULT NULL );

Parameters

Table 30-5 INSERT_GEOM_METADATA Parameters

Parameter Description

p_table_name

The name of the feature table.

p_column_name

The name of the column of type mdsys.sdo_geometry.

p_diminfo

The SDO_DIM_ELEMENT array, ordered by dimension, with one entry for each dimension.

p_srid

The SRID value for the coordinate system for all geometries in the column.

p_create_index_name

If not null, a spatial index on the column is created with this name. Only simple column names are supported, function based indexes or indexes on object attributes cause an error. For more complex requirements, leave this parameter null (the default) and manually create the index.

Example

This example creates table CITIES, spatial metadata and an index on column CITIES.SHAPE.

create table cities (
    city_id   number primary key,
    city_name varchar2(30),
    shape     mdsys.sdo_geometry )
/
begin
    apex_spatial.insert_geom_metadata (
        p_table_name   => 'CITIES',
        p_column_name  => 'SHAPE',
        p_diminfo     => SDO_DIM_ARRAY (
            SDO_DIM_ELEMENT('X', -180, 180, 1),
            SDO_DIM_ELEMENT('Y',  -90,  90, 1) ),
        p_srid        => apex_spatial.c_wgs_84 );
end;
/
   create index cities_idx_shape on cities(shape) indextype is mdsys.spatial_index
/