问题
I have a Oracle 11g DB. I store Latitude and Longitudes (for lets say stores or shops). Now i need a query which will calculate the distance between the shops and my location(which i will provide in the query). I have done this earlier in MySQL, but in Oracle there is no Radians function. So i need work aronud in Oracle SQL.
Help Appreciated. Thank You.
回答1:
Create a function that converts degrees to radians:
CREATE OR REPLACE FUNCTION degree_to_radian(p_degree IN NUMBER)
RETURN NUMBER IS
BEGIN
RETURN p_degree / 57.2957795;
END degree_to_radian;
回答2:
or even more precise:
RETURN p_degree /(180/ACOS(-1));
来源:https://stackoverflow.com/questions/20236676/lat-lon-distance-calculation-query-in-oracle