User's Guide and Reference

ST_AsText

db2gse.ST_AsText takes a geometry object and returns its well-known text representation.

Syntax

db2gse.ST_AsText(g db2gse.ST_Geometry)

Return type

Varchar(4000)

Examples

In the scenario that follows, the db2gse.ST_AsText function converts the HAZARDOUS_SITES location point into its text description:

CREATE TABLE HAZARDOUS_SITES (site_id   integer,
                              name      varchar(40),
                              location  db2gse.ST_Point);
INSERT INTO HAZARDOUS_SITES
VALUES (102,
        'W. H. Kleenare Chemical Repository',
        db2gse.ST_PointFromText('point (1020.12 324.02)', db2gse.coordref()..srid(0)));
 
SELECT site_id, name, cast(db2gse.ST_AsText(location) as varchar(40)) "Location" 
FROM HAZARDOUS_SITES;

The SELECT statement returns the following result set:

SITE_ID Name                                 Location
------- ------------------------------------ ----------------------------------------
    102 W. H. Kleenare Chemical Repository   POINT (1020.00000000 324.00000000) 


[ Top of Page | Previous Page | Next Page ]