ST_IsEmpty toma um objeto de figura geométrica e retorna 1 (VERDADEIRO) se estiver vazio; do contrário, retornará 0 (FALSO).
Sintaxe
db2gse.ST_IsEmpty(g db2gse.ST_Geometry)
Tipo de retorno
Inteiro
Exemplos
A seguinte instrução CREATE TABLE cria a tabela EMPTY_TEST, com duas colunas. A coluna GEOTYPE armazena o tipo de dados das classes filhas que estão armazenadas na coluna de figura geométrica G1.
CREATE TABLE EMPTY_TEST (geotype varchar(20), g1 db2gse.ST_Geometry)
A seguinte instrução INSERT insere dois registros para o ponto, cadeia de linha e polígono da classes filhas de figura geométrica. Um registro está vazio e outro não.
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)))
A seguinte instrução SELECT e o conjunto de resultados correspondente mostram a coluna tipo de figura geométrica e os resultados da função 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.