我有两个名为的表my_nodes
,restaurants
其中包含名称和geoloc
数据。我需要为每个 my_node 返回最近的餐厅和从节点到餐厅的距离的表。
select n.node_id, r.r_name , sdo_nn_distance(1) as min_distance from
(select nodeid as node_id, geoloc from my_nodes@my_server ) n,
(select r_name, GEOLOC from restaurants) r
where sdo_nn (n.geoloc, r.GEOLOC, 'Unit = MILE sdo_num_res = 1', 1) = '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
如何解决?