25.12 SDO_GEOM.SDO_DIAMETER

Note:

This feature is available starting with Oracle Database 12c Release 1 (12.1.0.2).

Format

SDO_GEOM.SDO_DIAMETER(     
  geom  IN SDO_GEOMETRY,      
  dim   IN SDO_DIM_ARRAY      
  [, unit  IN VARCHAR2]      
) RETURN NUMBER;

or

SDO_GEOM.SDO_DIAMETER(     
  geom  IN SDO_GEOMETRY,      
  tol   IN NUMBER       
  [, unit  IN VARCHAR2]      
) RETURN NUMBER;

Description

Returns the length of the diameter of a geometry object.

Parameters

geom

Geometry object.

dim

Dimensional information array corresponding to geom, usually selected from one of the xxx_SDO_GEOM_METADATA views (described in Geometry Metadata Views).

tol

Tolerance value (see Tolerance).

unit

Unit of measurement: a quoted string with unit= and an SDO_UNIT value from the MDSYS.SDO_DIST_UNITS table (for example, 'unit=KM'). See Unit of Measurement Support for more information about unit of measurement specification.

If this parameter is not specified, the unit of measurement associated with the data is assumed. For geodetic data, the default unit of measurement is meters.

Usage Notes

This function can be used for circle and non-circle geometry objects. The input geometry does not need to contain any curves.

The returned diameter length is the maximum distance between any two points in the geometry object. (For a formal definition of diameter, see a college-level mathematics textbook or other appropriate reference source.)

The input geometry can have no more than two dimensions.

If a point geometry is specified, the function returns 0 (zero).

Examples

The following example returns the diameter length of all geometry objects stored in the COLA_MARKETS table. (The example uses the definitions and data from Simple Example: Inserting_ Indexing_ and Querying Spatial Data.)

SELECT name, SDO_GEOM.SDO_DIAMETER(shape, 0.005) Diameter
  FROM cola_markets;
 
NAME                               DIAMETER                                     
-------------------------------- ----------                                     
cola_a                           7.21110255                                     
cola_b                           6.70820393                                     
cola_c                           3.60555128                                     
cola_d                                    4