我尝试在Oracle Database 11g企业版(11.1.0.6.0)上执行下一个查询:
SELECT "__ItemId"
FROM "Cities"
WHERE "Longitude" IS NOT NULL AND "Latitude" IS NOT NULL
AND SDO_ANYINTERACT(SDO_GEOMETRY('POINT(' || "Longitude" || ' ' || "Latitude" || ')'),
SDO_UTIL.FROM_WKTGEOMETRY('POLYGON ((-100 80, 100 80, 100 -80, -100 -80, -100 80))')) = 'TRUE'
“城市”表格中的“经度”和“纬度” - 数字[NUMBER(28,5)]列。
UPD :下一个查询(具有相同的错误)可用于测试:
SELECT 'Solved!'
FROM DUAL
WHERE SDO_ANYINTERACT(SDO_GEOMETRY('POINT(' || 100 || ' ' || 100 || ')'),
SDO_UTIL.FROM_WKTGEOMETRY('POLYGON ((-150.0 82.0, 150.0 82.0, 150.0 -67.0, -150.0 -67.0, -150.0 82.0))')) = 'TRUE';
我收到错误:
Error report -
SQL Error: ORA-13226: interface not supported without a spatial index
ORA-06512: at "MDSYS.MD", line 1723
ORA-06512: at "MDSYS.MDERR", line 8
ORA-06512: at "MDSYS.SDO_3GL", line 71
ORA-06512: at "MDSYS.SDO_3GL", line 239
13226. 00000 - "interface not supported without a spatial index"
*Cause: The geometry table does not have a spatial index.
*Action: Verify that the geometry table referenced in the spatial operator
has a spatial index on it.
问题:
答案 0 :(得分:1)
正如错误消息所述,您需要一个空间索引列来使用Spatial运算符。
您可以使用掩码“ANYINTERACT”从RELATE
包中的SDO_GEOM
函数获得等效功能:
SELECT sdo_geom.relate(a, 'ANYINTERACT', b, 0.05)
FROM dual
http://docs.oracle.com/cd/B19306_01/appdev.102/b14255/sdo_objgeom.htm#BGHCDIDG
答案 1 :(得分:0)
首先,你不能在没有任何空间列的桌子上创建空间索引,而sdo_anyinteract使用空间索引,oracle中有许多空间操作符你可以尝试另一个,
我不确定,但您可以尝试sdo_relate(obj1,obj2,'querytype=window mask=anyintereact')