Legal | Privacy
-- Finds the 5 closest customers to warehouse_id = 2 
-- and orders the results by distance

select /*+ordered*/ 
         c.customer_id, 
         c.cust_first_name, 
         c.cust_last_name,
         sdo_nn_distance (1) distance
from warehouses w, 
         customers c
where w.warehouse_id = 2
and sdo_nn (c.cust_geo_location, w.wh_geo_location, 'sdo_num_res=5', 1) = 'TRUE'
order by distance;
E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy