ST_IsEmpty takes a geometry object and returns 1 (TRUE) if it is empty; otherwise it returns 0 (FALSE).
Syntax
db2gse.ST_IsEmpty(g db2gse.ST_Geometry)
Return type
Integer
Examples
The following CREATE TABLE statement creates the EMPTY_TEST table with two columns. The GEOTYPE column stores the data type of the subclasses that are stored in the G1 geometry column.
CREATE TABLE EMPTY_TEST (geotype varchar(20), g1 db2gse.ST_Geometry)
The following INSERT statements insert two records for the geometry subclasses point, linestring, and polygon. One record is empty and one is not.
INSERT INTO EMPTY_TEST VALUES('Point', db2gse.ST_PointFromText('point (10.02 20.01)', db2gse.coordref()..srid(0))) INSERT INTO EMPTY_TEST VALUES('Point', db2gse.ST_PointFromText('point empty', db2gse.coordref()..srid(0))) INSERT INTO EMPTY_TEST VALUES('Linestring', db2gse.ST_LineFromText('linestring (10.02 20.01,10.32 23.98, 11.92 25.64)', db2gse.coordref()..srid(0))) INSERT INTO EMPTY_TEST VALUES('Linestring', db2gse.ST_LineFromText('linestring empty', db2gse.coordref()..srid(0))) INSERT INTO EMPTY_TEST VALUES('Polygon', db2gse.ST_PolyFromText('polygon ((10.02 20.01,11.92 35.64, 25.02 34.15,19.15 33.94,10.02 20.01))', db2gse.coordref()..srid(0))) INSERT INTO EMPTY_TEST VALUES('Polygon', db2gse.ST_PolyFromText('polygon empty', db2gse.coordref()..srid(0)))
The following SELECT statement and corresponding result set show the geometry type from the GEOTYPE column and the results of the ST_IsEmpty function.
SELECT geotype, db2gse.ST_IsEmpty(g1) "It is empty" FROM EMPTY_TEST GEOTYPE It is empty -------------------- ----------- ST_Point 0 ST_Point 1 ST_Linestring 0 ST_Linestring 1 ST_Polygon 0 ST_Polygon 1 6 record(s) selected.