Reputation: 203
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.
Upvotes: 2
Views: 5001
Reputation: 59642
or even more precise:
RETURN p_degree /(180/ACOS(-1));
Upvotes: 2
Reputation: 3325
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;
Upvotes: 6