Oracle中的纬度距离计算查询 [英] Lat Lon Distance Calculation query in Oracle

查看:103
本文介绍了Oracle中的纬度距离计算查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Oracle 11g数据库.我存储纬度和经度(比方说商店或商店).现在我需要一个查询,该查询将计算商店和我的位置之间的距离(我将在查询中提供).我早些时候在MySQL中完成了此操作,但是在Oracle中没有Radians函数.因此,我需要在Oracle SQL中进行工作.

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.

帮助感激.谢谢.

推荐答案

创建将度数转换为弧度的函数

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;

这篇关于Oracle中的纬度距离计算查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆