Lat Lon Distance Calculation query in Oracle(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 中的经纬度距离计算查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Oracle 中的经纬度距离计算查询
基础教程推荐
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 无法解决整理冲突 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
