ST_Endpoint 使用一條線串並傳回一個點 (這個點是該線串的最後一點)。
語法
db2gse.ST_Endpoint(c db2gse.ST_Curve)
回覆類型
db2gse.ST_Point
範例
ENDPOINT_TEST 表格儲存唯一識別每一列的 GID 整數直欄和儲存線串的 LN1 線串直欄。
CREATE TABLE ENDPOINT_TEST (gid integer, ln1 db2gse.ST_LineString)
INSERT 陳述式將線串插入 ENDPOINT_TEST 表格。 第一條線串沒有 Z 座標或測量;第二條線串有 Z 座標和測量。
INSERT INTO ENDPOINT_TEST VALUES( 1, db2gse.ST_LineFromText('linestring (10.02 20.01,23.73 21.92,30.10 40.23)', db2gse.coordref()..srid(0))) INSERT INTO ENDPOINT_TEST VALUES (2, db2gse.ST_LineFromText('linestring zm (10.02 20.01 5.0 7.0,23.73 21.92 6.5 7.1, 30.10 40.23 6.9 7.2)', db2gse.coordref()..srid(0)))
下列 SELECT 陳述式列示具有 ST_Endpoint 函數輸出的 GID 直欄。 ST_Endpoint 函數產生一個點幾何,ST_AsText 函數將該幾何轉換成文字。 CAST 函數是用來將 ST_AsText 函數的預設 varchar(4000) 值縮短成 varchar(60)。
SELECT gid, CAST(db2gse.ST_AsText(db2gse.ST_Endpoint(ln1)) AS varchar(60)) "Endpoint" FROM ENDPOINT_TEST
傳回下列結果集。
GID Endpoint ----------- ------------------------------------------------------------ 1 POINT ( 30.10000000 40.23000000) 2 POINT ZM ( 30.10000000 40.23000000 7.00000000 7.20000000) 2 record(s) selected.