2

我试图在 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.

问题:

  1. 如何检查指定多边形中具有指定“经度”和“纬度”的点?多边形并不总是简单的,它可以是任何的。
  2. 如何在没有任何空间列的表上创建空间索引?
  3. 真的,不能只叫空间算子吗?
4

2 回答 2

1

As the error messages state, you need a Spatially indexed column to make use of the Spatial operators.

You can get equivalent functionality from the RELATE function in the SDO_GEOM package using the mask "ANYINTERACT":

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

于 2013-12-29T11:34:58.973 回答
0

首先,你不能在没有任何空间列的表上创建空间索引,并且 sdo_anyinteract 使用空间索引,oracle中有很多空间运算符你可以尝试另一个,

我不确定,但你可以试试sdo_relate(obj1,obj2,'querytype=window mask=anyintereact')

希望它有效。

于 2013-12-24T13:12:34.040 回答