Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
测试 ST_Curve 值是否为环。如果曲线闭合且简单(不自相交),则曲线是环。
curve-expression.ST_IsRing()
BIT 如果曲线是环(且非空),则返回 1。否则返回 0。
SQL/MM (ISO/IEC 13249-3: 2006) 7.1.6
以下示例返回 SpatialShapes 中所有包含环的行。需要 IF 表达式来确保在 Shape 不是 ST_Curve 的子类型的情况下不执行 TREAT 函数。没有 IF 表达式,服务器会对 WHERE 子句中的条件重新排序,从而导致错误。
SELECT * FROM SpatialShapes WHERE IF Shape IS OF ( ST_Curve ) AND TREAT( Shape AS ST_Curve ).ST_IsRing() = 1 THEN 1 ENDIF = 1
以下示例返回 curve_table 中所有包含环几何的行。本示例假设几何列具有类型 ST_Curve、ST_LineString、ST_CircularString 或 ST_CompoundCurve。
SELECT * FROM curve_table WHERE geometry.ST_IsRing() = 1