Re: Querying distances between two coordinates

From: Charles Hooper <>
Date: Fri, 10 Jun 2011 11:09:40 -0700 (PDT)
Message-ID: <>

On Jun 10, 12:15 pm, Jeremy <> wrote:
> Hi this is a 10gR2 Standard Edition question.
> The requirement is to be able to calculate the distance between two co-
> oordinates expressed as latitude and longitude.
> Q1) How would the latitude and longitude be stored in an Oracle table
> (what data types)?
> Q2) What would an example query look like?
> Q3) Is this even possible with 10gR2 Standard Edition?
> Just to be clear (!) this is the sort of simplistic representation I
> guess
> item           lat          long
> ----           ---          ----
> P1             50.716667    -1.883333
> P2             51.023332    -1.872231
> The format of the lat/long are as I have been informed they are recorded
> in a remote system with which we are needing to integrate.
> I would want to be able to calculate the straight line distance between
> P1 and P2.
> Thanks for any pointers!
> --
> jeremy

I vaguely remember teaching a class how to do this calculation of distance around a spherical object in the early 1990s (with only a calculator) - I could probably search and find the lesson plan which is probably right next to the proof that 1=2. While I am searching for that lesson plan, see if the following article is helpful:

Charles Hooper
Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc. Received on Fri Jun 10 2011 - 13:09:40 CDT

Original text of this message