我有一张桌子
NODES
RESTAURANTS
用他们的
GEOLOC
和坐标。
select n.geoloc.sdo_point.y as node_y, n.geoloc.sdo_point.x as node_x,
r.state as r_state, r.geoloc.sdo_point.y as r_y, r.geoloc.sdo_point.x as r_x,
sdo_nn_distance(1) as distance_mi
from DC_NODE n, RESTAURANTS r
where sdo_nn (n.geoloc, r.geoloc, 'Unit = MILE sdo_num_res = 1',1) ='TRUE'
NODE_Y NODE_X R_state R_Y R_X distance_mi
38. -77. AK 56. -132. 2752.
sdo_nn_distance(1)
和
where sdo_nn(...)
应该将结果集约束到一组节点和相应的最近餐馆。甲骨文似乎忽略了最短距离子句。
--DC Restaurants are in the table
select r.STATE, r.geoloc.sdo_point.y as r_y, r.geoloc.sdo_point.x as r_x
from RESTAURANTS rwhere r.state = 'DC'
DC 38. -77.
DC 38. -76.
DC 38. -77.
为什么Oracle忽略了“find the nearest”子句以及如何修复它?