spatial 检索的时候
SELECT b1.b_id
FROM building b1,building b2
WHERE b2.b_ID=‘b3‘
AND sdo_nn(b2.shape, b1.shape,
‘sdo_num_res=5‘, 0.5) = ‘TRUE‘;
出现这种错误:
ORA-13249: SDO_NN cannot be evaluated without using index
ORA-06512: at "MDSYS.MD", line 1723
ORA-06512: at "MDSYS.MDERR", line 17
ORA-06512: at "MDSYS.PRVT_IDX", line 9
解决方案:
SELECT b1.b_id
FROM building b1,building b2
WHERE b2.b_ID=‘b3‘
AND sdo_nn(b1.shape, b2.shape,
‘sdo_num_res=5‘, 0.5) = ‘TRUE’;
因为oracle的sdo_nn()方法,第一个参数instance.geometry需要是已经存在数据的,而第二个参数是待检索的。如果两个参数颠倒,就会出现如上所示的错误。
时间: 2024-12-09 09:35:47