ST_TOPOINT scalar function

The ST_TOPOINT function takes a geometry as an input parameter and converts it to a point.

The specified geometry must be a point.

If geometry is null, the result is the null value. An empty point is not supported.

Read syntax diagramSkip visual syntax diagramST_TOPOINT(geometry)
geometry
A value of type ST_GEOMETRY or one of its subtypes that represents the geometry that is converted to a point.
A geometry can be converted to a point if it is a point. If the conversion cannot be performed, an exception condition is raised.

The result of the function is ST_POINT.

Example

This example creates three geometries in SAMPLE_GEOMETRIES and converts each to a point.

CREATE TABLE sample_geometries (id INTEGER, geometry QSYS2.ST_GEOMETRY);
CREATE TABLE sample_points (id INTEGER, point QSYS2.ST_POINT);

INSERT INTO sample_geometries
  VALUES (1, QSYS2.ST_POINT('point (30 40)'));

INSERT INTO sample_points 
 (SELECT ID, QSYS2.ST_TOPOINT(geometry)
   FROM sample_geometries);
   
SELECT id, QSYS2.ST_ASTEXT(point) AS points FROM sample_points;

Results:


ID       POINTS
-------  ----------------------------
      1  POINT (30.0 40.0)