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 6947741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:43:55+00:00 2026-05-27T13:43:55+00:00

DROP TYPE Position; CREATE OR REPLACE TYPE Position AS OBJECT (longitude NUMBER(11,7), lattitude NUMBER(11,7),

  • 0
DROP TYPE Position;

CREATE OR REPLACE TYPE 
Position AS OBJECT
(longitude NUMBER(11,7),
lattitude NUMBER(11,7),
CONSTRUCTOR FUNCTION Position(
    long NUMBER,
    latt NUMBER
    ) RETURN SELF AS RESULT
)FINAL;
/


CREATE OR REPLACE TYPE BODY Position AS
CONSTRUCTOR FUNCTION Position(
    long NUMBER,
    latt NUMBER
    ) RETURN SELF AS RESULT IS
  BEGIN
      SELF.longitude := long;
      SELF.lattitude := latt;
  RETURN;
  END;

END;
/

DESC Position;


DROP TABLE District_Info;

CREATE TABLE District_Info(
Dname VARCHAR2(20),
DPos Position,
Boundary_dist VARCHAR2(20),
Launch_ghat CHAR(1)
);

DESC District_Info;


INSERT INTO District_Info (Dname,DPos,Boundary_dist,Launch_ghat)
VALUES ('d',Position(1.1, 1.1),'gr','y');
  • 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-05-27T13:43:56+00:00Added an answer on May 27, 2026 at 1:43 pm

    Your problem is that you have defined two constructors of the same type, but you didn’t realize you did probably.

    When you create an object type, Oracle creates a default constructor, with parameters that match the parameters of the type. Therefore, when you also defined a constructor with only lattitude and longitude as inputs, Oracle cannot work out which constructor to call, the default created one, or your one, so it errors with:

    SQL Error: ORA-06553: PLS-307: too many declarations of 'POSITION' match this call
    

    To fix this, you can simplify your code:

    drop type position;
    
    CREATE OR REPLACE TYPE Position AS OBJECT (longitude NUMBER(11,7), lattitude NUMBER(11,7))
    /
    
    DROP TABLE District_Info;
    
    CREATE TABLE District_Info( Dname VARCHAR2(20), DPos Position, Boundary_dist VARCHAR2(20), Launch_ghat CHAR(1) );
    
    
    INSERT INTO District_Info (Dname,DPos,Boundary_dist,Launch_ghat) VALUES ('d',Position(1.1),'gr','y');
    

    Ie, you don’t need the constructor declaration or the body. If you like, you can have a DIFFERENT constructor, eg:

    CREATE OR REPLACE TYPE Position AS OBJECT (longitude NUMBER(11,7), lattitude NUMBER(11,7),
    -- Define a constructor that has only 2 parameters.
      CONSTRUCTOR FUNCTION position(i_longitude NUMBER)
        RETURN SELF AS RESULT
    )
    /
    
    CREATE OR REPLACE TYPE BODY Position AS 
      CONSTRUCTOR FUNCTION position(i_longitude NUMBER)
        RETURN SELF AS RESULT IS 
      BEGIN 
        SELF.longitude := i_longitude; 
        SELF.lattitude := i_longitude; 
        RETURN; -- self; 
      END;
    END; 
    /
    
    show errors;
    
    DROP TABLE District_Info;
    
    CREATE TABLE District_Info( Dname VARCHAR2(20), DPos Position, Boundary_dist VARCHAR2(20), Launch_ghat CHAR(1) );
    
    DESC District_Info;
    
    INSERT INTO District_Info (Dname,DPos,Boundary_dist,Launch_ghat) VALUES ('d',Position(1.1),'gr','y');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to return a Custom type from a PostgreSQL function as follows: DROP
So I have this code: jQuery('div[class=someClass] :input:not(:button)').each(function() { if (input type is drop-down) {
I drop a pin in an MKMapView with longitude and latitude. When I place
Is there drop-in replacement for ActiveRecord that uses some sort of Object Store? I
I am working on a web based drag and drop type application.I could drag
I am trying to remove all the controls (zoom, map type drop down, and
I'm trying to replace MultiAutoCompleteTextView Drop down list with a ListView, which it should
We have a table as: CREATE TABLE ESIPARIS.T_ORDER_LINE ( NO NUMBER(18), ORDER_NO NUMBER(18), ITEM_NO
There is nothing in the Data Type drop-down that indicates an auto-counter. I selected
Im trying to make a drag and drop system for a game type inventory,

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.