ST_WKTToSQL
ST_WKTToSQL takes a well-known text representation of a geometry and returns the corresponding geometry. The spatial reference system with the identifier 0 (zero) is used for the resulting geometry.
If the given well-known text representation is null, null is returned.
Syntax
Parameter
- wkt
- A value of type CLOB(8M) that contains the well-known text representation of the resulting geometry. If the well-known text representation is null, null is returned.
Return type
db2gse.ST_Geometry
Example
This example illustrates how ST_WKTToSQL
can create and insert geometries using their well-known text representations.
SET CURRENT PATH = CURRENT PATH, db2gse
CREATE TABLE sample_geometries (id INTEGER, geometry ST_Geometry)
INSERT INTO sample_geometries
VALUES (10, ST_WKTToSQL( 'point (44 14)' ) ),
(11, ST_WKTToSQL( 'point (24 13)' ) ),
(12, ST_WKTToSQL ('polygon ((50 20, 50 40, 70 30, 50 20))' ) )
This SELECT statement returns the geometries that have
been inserted.
SELECT id, CAST( ST_AsText(geometry) AS VARCHAR(120) ) GEOMETRIES
FROM sample_geometries
Results:
ID GEOMETRIES
----------- -------------------------------------------------------------
10 POINT ( 44.00000000 14.00000000)
11 POINT ( 24.00000000 13.00000000)
12 POLYGON (( 50.00000000 20.00000000, 70.00000000 30.00000000,
50.00000000 40.00000000, 50.00000000 20.00000000))
