How can I query for multi-part features in an SDE.ST_GEOMETRY FC using SQL? (in the Select By Attributes window or in a definition query)
Use this WHERE clause in a definition query or the Select By Attributes window:
sde.st_numgeometries(shape) > 1
There is a known bug in versioned Oracle SDE.ST_GEOMETRY FCs. The above WHERE clause will throw an error: ORA-00904 Invalid Identifier "SHAPE".
Workaround:
Use a subquery.
objectid in
(select
objectid
from
my_owner.my_fc
where
sde.st_numgeometries(shape) > 1)
That bug only happens for SDE.ST_GEOMETRY.
Whereas if the FC was SDO_GEOMETRY, then spatial functions would work fine — even if the FC was versioned.
sdo_util.getnumelem(shape) > 1
BUG-000150273
Status
In Review
Synopsis
ST_Geometry functions applied to the Shape field in Select By Attributes return the error message, "Error 000358: Invalid expression" if the feature class is registered as traditional versioned.
Environment
Reproduced in: ArcGIS Pro 3.0 or ArcGIS Pro 2.9.3 or ArcMap 10.8.2 or ArcMap 10.7.1
Geodatabase version 10.9.2 or 10.7.1
Oracle 18c
Steps to Reproduce
Additional information
Workarounds
OBJECTID IN
(SELECT
OBJECTID
FROM
USER1.ACTIVE_TRANSPORTATION
where
sde.st_length(shape) > 400
)