35.29 SDO_UTIL.GETFIRSTVERTEX

Format

SDO_UTIL.GETFIRSTVERTEX(
     geometry  IN SDO_GEOMETRY 
     ) RETURN MDSYS.VERTEX_TYPE;

Description

Returns the first coordinate of the vertices of the input geometry.

Parameters

geometry

Input geometry.

Usage Notes

This function returns an object of type MDSYS.VERTEX_TYPE, which is defined as follows:

CREATE TYPE vertex_type AS OBJECT
 (x   NUMBER,
  y   NUMBER,
  z   NUMBER,
  w   NUMBER,
  v5  NUMBER,
  v6  NUMBER,
  v7  NUMBER,
  v8  NUMBER,
  v9  NUMBER,
  v10 NUMBER,
  v11 NUMBER,
  id  NUMBER);

The MYSYS.VERTEX_TYPE type is intended for Oracle use only. Do not use this type in column definitions or in functions that you create.

Examples

This example assumes a table named DATA_2D that has been created and populated as follows:

CREATE TABLE data_2d (geom_name varchar2(12), shape sdo_geometry);

INSERT INTO data_2d VALUES ( 'LINE1',
   sdo_geometry(2002, NULL, NULL,
   sdo_elem_info_array(1,2,1),
   sdo_ordinate_array(12,13, 14,15, 16,17, 18,19, 20,21)));

The following SELECT statement calls both the SDO_UTIL.GetFirstVertex and SDO_UTIL.GetLastVertex functions. The result shows that the first vertex is at (12,13) and the last vertex is at (20,21). (The output is reformatted for readability.)

SELECT geom_name,
       sdo_util.GetFirstVertex(a.shape).X,
       sdo_util.GetFirstVertex(a.shape).Y
FROM data_2d a;

GEOM_NAME    SDO_UTIL.GETFIRSTVERTEX(A.SHAPE).X SDO_UTIL.GETFIRSTVERTEX(A.SHAPE).Y
------------ ---------------------------------- ----------------------------------
LINE1                                        12                                 13


SELECT geom_name,
       sdo_util.GetLastVertex(a.shape).X,
       sdo_util.GetLastVertex(a.shape).Y
FROM data_2d a;

GEOM_NAME    SDO_UTIL.GETLASTVERTEX(A.SHAPE).X SDO_UTIL.GETLASTVERTEX(A.SHAPE).Y
------------ ---------------------------------- ----------------------------------
LINE1                                       20                                21

Related Topics