如果我运行以下查询:
select B3.bid as id ,B3.bshape as shape
from Buildings B3
where B3.bid in
(
select distinct B1.bid from Buildings B1,
(
select * from Buildings B where B.bname in (select BOF.bname from Buildings_On_Fire BOF)
) B2 where sdo_nn(B1.bshape, B2.bshape, 'distance=100') = 'TRUE' and B1.bname != b2.bname
)
我收到以下错误:
第 1 行的错误:
ORA-13249:不使用索引就无法评估 SDO_NN
ORA-06512:在“MDSYS.MD”,第 1723 行
ORA-06512:在“MDSYS.MDERR”,第 17行 ORA-06512:在“MDSYS.MD”
。 PRVT_IDX”,第 9 行
但是,如果只运行以下子查询:
select distinct B1.bid from Buildings B1,
(
select * from Buildings B where B.bname in (select BOF.bname from Buildings_On_Fire BOF)
) B2 where sdo_nn(B1.bshape, B2.bshape, 'distance=100') = 'TRUE' and B1.bname != b2.bname
这执行得很好。我已经验证了空间索引,它们似乎是有效的。
我是 Oracle 新手,不知道下一步该做什么。请帮忙。
如果有不需要更改上述查询的解决方案,那将是最好的。