title: Calculate distance between two lat long points in Oracle
body: <p>I'm trying to calculate the distance between two lat long points in Oracle using SDO_GEOM Package.
  Most of the solutions I read on the internet suggests below query:</p>
  
  <pre><code>select sdo_geom.sdo_distance(
    sdo_geometry(2001, 4326, sdo_point_type(40.0, 10.0, null), null, null),
    sdo_geometry(2001, 4326, sdo_point_type(40.0, 11.0, null), null, null),
    0.01,
    'unit=KM'
  ) as distance
  from dual;
  </code></pre>
  
  <p>However, when I use an online tool to validate the result, it seems to be incorrect:</p>
  
  <p>Try (40,10), (40,11) on:</p>
  
  <p><a href="http://www.meridianoutpost.com/resources/etools/calculators/calculator-latitude-longitude-distance.php?" rel="nofollow noreferrer">http://www.meridianoutpost.com/resources/etools/calculators/calculator-latitude-longitude-distance.php</a></p>
  
  <p>Any idea why the distance calculation is incorrect even if I'm using a geographic coordinate system (4326) in the query? </p>