ST_NumInteriorRing takes a polygon and returns the number of its interior rings.
Syntax
db2gse.NumInteriorRing(p db2gse.ST_Polygon)
Return type
Integer
Examples
An ornithologist, wishing to study a bird population on several south sea islands, knows that the feeding zone of a particular species is restricted to islands containing fresh water lakes. Therefore, she wants to know which islands contain one or more lakes.
The following CREATE TABLE statement creates the ISLANDS table. The ID and NAME columns of the ISLANDS table identify each island, and the LAND polygon column stores the island's geometry.
CREATE TABLE ISLANDS (id integer, name varchar(32), land db2gse.ST_Polygon);
Because interior rings represent the lakes, the ST_NumInteriorRing function is used to list only those islands that have at least one interior ring.
SELECT name FROM ISLANDS WHERE db2gse.ST_NumInteriorRing(land) > 0;