我有两张桌子
my_nodes
restaurants
包含名称和
geoloc
数据我需要得到一个表,每个my_节点返回最近的餐厅以及从节点到餐厅的距离。
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
如何修复它?