User's Guide and Reference

ST_IsRing

ST_IsRing takes a linestring and returns 1 (TRUE) if it is a ring (namely, the linestring is closed and simple); otherwise, it returns 0 (FALSE).

Syntax

db2gse.ST_IsRing(c db2gse.ST_Curve)

Return type

Integer

Examples

The following CREATE TABLE statement creates the RING_LINESTRING table, which has a single linestring column that is called LN1.

CREATE TABLE RING_LINESTRING (ln1 db2gse.ST_LineString)

The following INSERT statements insert three linestrings into the LN1 column. The first row contains a linestring that is not closed and therefore is not a ring. The second row contains a linestring that is closed and is simple and therefore is a ring. The third row contains a linestring that is closed but is not simple because it intersects its own interior, and therefore is not a ring.

INSERT INTO RING_LINESTRING
VALUES(db2gse.ST_LineFromText('linestring  (10.02 20.01,10.32 23.98,11.92 25.64)',
                    db2gse.coordref()..srid(0)))
 
INSERT INTO RING_LINESTRING
VALUES(db2gse.ST_LineFromText('linestring (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 RING_LINESTRING
VALUES(db2gse.ST_LineFromText('linestring (15.47 30.12,20.73 22.12,10.83 14.13,
                                 16.45 17.24,21.56 13.37,11.23 22.56,
                                 19.11 26.78,15.47 30.12)',
                    db2gse.coordref()..srid(0)))
 

The following SELECT statement and the corresponding result set shows the results of the ST_IsRing function. The first and third rows return a 0. This is because the linestrings are not rings, while the second row returns a 1 because it is a ring.

SELECT db2gse.ST_IsRing(ln1) "Is it ring" FROM RING_LINESTRING
 
Is it ring
-----------
          0
          1
          0
 
  3 record(s) selected.


[ Top of Page | Previous Page | Next Page ]