ST_TOMULTIPOINT scalar function
The ST_TOMULTIPOINT function takes a geometry as an input parameter and converts it to a multipoint.
The specified geometry must be a point or a multipoint.
If geometry is null, the result is the null value. An empty multipoint is not supported.
- geometry
- A value of type ST_GEOMETRY or one of its subtypes that represents the geometry that is converted to a multipoint.
The result of the function is ST_MULTIPOINT.
Example
In the following SELECT statement, the ST_TOMULTIPOINT function is used to return multipoints converted to ST_MULTIPOINT from the static type of ST_GEOMETRY.
CREATE TABLE sample_geometries (id INTEGER, geometry QSYS2.ST_GEOMETRY);
CREATE TABLE sample_multipoints (id INTEGER, multipoint QSYS2.ST_MULTIPOINT);
INSERT INTO sample_geometries
VALUES (1, QSYS2.ST_MULTIPOINT('multipoint ((0 0), (0 4))')),
(2, QSYS2.ST_POINT('point (30 40)'));
INSERT INTO sample_multipoints
(SELECT ID, QSYS2.ST_TOMULTIPOINT(geometry)
FROM sample_geometries);
SELECT id, QSYS2.ST_ASTEXT(multipoint) AS multipoint FROM sample_multipoints;
Results:
ID MULTIPOINT
------- --------------------------------------------------------------
1 MULTIPOINT ((0.0 0.0), (0.0 4.0))
2 MULTIPOINT ((30.0 40.0))