我有一个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(...)
应该将结果集限制为一组节点和相应的最近餐厅。 Oracle似乎忽略了最短距离子句。
我确实在节点附近有条目:
--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会忽略“查找最近的”子句以及如何解决它?
答案 0 :(得分:0)
更改了args的顺序以解决问题
sdo_nn (from_these_objects_to_choose.geoloc, for_each_of_these_objects.geoloc, 'Unit = MILE sdo_num_res = 1',1) ='TRUE'