Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8643739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:07:32+00:00 2026-06-12T12:07:32+00:00

I am writing a small query(ORACLE) for my project to find the distance from

  • 0

I am writing a small query(ORACLE) for my project to find the distance from a given latitude and longtitude to other latitude and longitude.

Below are the sample data that i used

 CREATE table test(id int, title varchar(50), place varchar(20),
 postcode varchar(20), latitude DOUBLE PRECISION, longitude DOUBLE
 PRECISION);

 INSERT INTO test VALUES(1,'sekhar91','kanigiri','91982',16.15074,
 -22.74426);

 INSERT INTO test VALUES(2,'sekhar91','kanigiri','91982',16.13725,
 -22.85822);

 INSERT INTO test VALUES(3,'sekhar91','kanigiri','91982',14.85633,
 -24.72379);

 INSERT INTO test VALUES(4,'sekhar91','kanigiri','91982',14.86949,
 -24.70150);

 INSERT INTO test VALUES(5,'sekhar91','kanigiri','91982',15.03118,
 -24.32523);

 INSERT INTO test VALUES(6,'sekhar91','kanigiri','91982',14.88924,
 -24.29403);

 INSERT INTO test VALUES(7,'sekhar91','kanigiri','91982',14.89500,
 -24.50000);

 INSERT INTO test VALUES(8,'sekhar91','kanigiri','91982',15.20031,
 -23.16798);

 INSERT INTO test VALUES(9,'sekhar91','kanigiri','91982',16.72662,
 -22.92971);

 INSERT INTO test VALUES(10,'sekhar91','kanigiri','91982',16.60005,
 -22.90818);

 INSERT INTO test VALUES(11,'sekhar91','kanigiri','91982',15.19196,
 -23.64427);

 INSERT INTO test VALUES(12,'sekhar91','kanigiri','91982',14.92331,
 -23.52119);

 INSERT INTO test VALUES(13,'sekhar91','kanigiri','91982',14.91637,
 -23.60410);

 INSERT INTO test VALUES(14,'sekhar91','kanigiri','91982',14.92279,
 -23.51720);

 INSERT INTO test VALUES(15,'sekhar91','kanigiri','91982',14.92331,
 -23.52119);

 INSERT INTO test VALUES(16,'sekhar91','kanigiri','91982',15.09882,
 -23.67105);

And the Sql Query tha i wrote is

SELECT id, 
       title, 
      ((ACOS(SIN(16.15074 * 3.141592653 / 180) *
        SIN(latitude * 3.141592653 / 180) +  COS(16.15074 * 3.141592653 / 180
        ) * COS(latitude * 3.141592653 / 180)* COS((-22.74426 -
       longitude)*3.141592653 /180))*180/3.141592653)*60*1.1515)  as distance
 FROM test  
 HAVING distance<=100

While executing the above query Oracle is saying

ORA-06553: PLS-306: wrong number or types of arguments in call to 'OGC_DISTANCE'

What is the reason and where i am wrong ?

Any help will be greatly appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:07:33+00:00Added an answer on June 12, 2026 at 12:07 pm

    It appears the issue is with the HAVING clause, I removed the HAVING and placed your query in a subquery and put the WHERE outside with the filter and it works (See SQL Fiddle With Demo):

    select *
    from
    (
      SELECT id, 
        title, 
        ((ACOS(
              SIN(16.15074 * 3.141592653 / 180) 
              * SIN(latitude * 3.141592653 / 180) 
              + COS(16.15074 * 3.141592653 / 180) 
              * COS(latitude * 3.141592653 / 180)
              * COS((-22.74426 - longitude)*3.141592653 /180))*180/3.141592653)*60*1.1515) as distance 
      FROM test
    ) x
    where distance <= 100
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing small application in python which read records from Oracle and insert
Coming from a PHP background, I'm used to writing small functions that return a
I am writing a small script that will query a database for a title
I am writing a small python script like this: #!/usr/bin/env python from sqlite3 import
I'm writing a small Node to just monitor MongoDB by making a simple query
I often find myself writing small (5-20 lines) files for things like input validation,
I am writing a small case statement in sql query as follows: SELECT [##OT_NET_EQUATIONS_RHS_IDS].SYS_ID,
I have a small hobby project where I'm writing a 'wrapper'-daemon in linux, in
I'm writing small XMPP server using boost::asio and I want to unit-test my code.
I am writing small app, using Play Framework 2.0 which uses Ebean as ORM.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.