35.53 SDO_UTIL.INSERT_SDO_GEOM_METADATA

Format

SDO_UTIL.INSERT_SDO_GEOM_METADATA(     
  owner       IN   VARCHAR2,
  table_name  IN VARCHAR2,
  column_name IN VARCHAR2,      
  diminfo     IN SDO_DIM_ARRAY,      
  srid        IN NUMBER);      

Description

Adds metadata for a spatial table to the geometry metadata views USER_SDO_GEOMETRY_METADATA and ALL_SDO_GEOMETRY_METADATA.

Parameters

owner

Name of the schema that owns the spatial table. Must be uppercase.

table_name

Name of the spatial table (a feature table that has a column of type SDO_GEOMETRY). Must be uppercase.

column_name

Name of the column of type SDO_GEOMETRY. Must be uppercase.

diminfo

Varying length array of an object type, ordered by dimension, and has one entry for each dimension. (The SDO_DIM_ARRAY type is explained in DIMINFO.)

srid

Either of the following: the SDO_SRID value for the coordinate system for all geometries in the column, or NULL if no specific coordinate system should be associated with the geometries.

Usage Notes

This procedure is an alternative to using the SQL INSERT statement to add metadata for a spatial table to the geometry metadata views. (The use of an INSERT statement to update the USER_SDO_GEOMETRY_METADATA view is shown in Simple Example: Inserting, Indexing, and Querying Spatial Data.)

To use this procedure on a spatial table in another user’s schema, you must have DBA privileges or the SELECT privilege on that other user’s table. For example, if USER1 wants to insert geometry metadata for the USER2.COLA_MARKETS table, then USER1 must have DBA privileges or the SELECT privilege on the USER2.COLA_MARKETS table.

Examples

The following example adds metadata for a spatial table named COLA_MARKETS with the geometry column named SHAPE in the USER2 schema. It also creates the spatial index. (The example uses the definitions and data from Simple Example: Inserting_ Indexing_ and Querying Spatial Data.)

---------------------------------------------------------------------------
-- UPDATE METADATA VIEWS --
---------------------------------------------------------------------------
-- Add information to the USER_SDO_GEOM_METADATA and USER_SDO_GEOM_METADATA views. This 
-- is required before the spatial index can be created. Do this only once for each layer
-- (that is, table-column combination; here: cola_markets and shape).

EXECUTE SDO_UTIL.INSERT_SDO_GEOM_METADATA ('USER2', 'COLA_MARKETS', 'SHAPE', -
  SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 0, 20, 0.005), -
                SDO_DIM_ELEMENT('Y', 0, 20, 0.005)), - 
  NULL);

-------------------------------------------------------------------
-- CREATE THE SPATIAL INDEX --
-------------------------------------------------------------------

CREATE INDEX cola_spatial_idx
ON cola_markets(shape)
INDEXTYPE IS MDSYS.SPATIAL_INDEX_V2;

Related Topics