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 中的经纬度距离计算查询
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- SQL 临时表问题 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
