ST_IsEmpty utilise en entrée un objet de type géométrie et renvoie la valeur 1 (TRUE) s'il est vide, et la valeur 0 (FALSE) dans le cas contraire.
Syntaxe
db2gse.ST_IsEmpty(g db2gse.ST_Geometry)
Type de retour
Integer
Exemples
L'instruction CREATE TABLE ci-après crée la table EMPTY_TEST, qui comporte deux colonnes. La colonne GEOTYPE stocke le type de données des sous-classes enregistrées dans la colonne de géométrie G1.
CREATE TABLE EMPTY_TEST (geotype varchar(20), g1 db2gse.ST_Geometry)
Les instructions INSERT présentées ci-dessous insèrent deux enregistrements associés aux sous-classes point, ligne et polygone. Un enregistrement est vide et l'autre ne l'est pas.
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)))
L'instruction SELECT ci-après et l'ensemble de résultats correspondant présentent le type de géométrie provenant de la colonne GEOTYPE et les résultats de la fonction ST_IsEmpty.
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.