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

查看:67
本文介绍了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天全站免登陆