[ad_1]
I have declared an object with a constructor that takes 2 arguments. I can’t use it because oracle returns:
[Error] Execution (2: 10): ORA-06553: PLS-307: too many declarations
of ‘BOUNDARY’ match this call
-
I haven’t declared this constructor more than one time.
-
My code is working on db fiddle but not on my database. The only difference between the code on dbfiddle and my code is that this object has an owner.
-
Therefore the name of the object is defined this way:
owner_name.object_name
. -
I have checked if the object is defined in another owner. And when I call the constructor I use
owner_name.constructor
. -
I’ve created a dummy constructor that take 0 arguments and it works.
_
CREATE OR REPLACE TYPE boundary AS OBJECT
(
v_start INTEGER,
v_end INTEGER,
CONSTRUCTOR FUNCTION boundary (i_start INTEGER, i_end INTEGER)
RETURN SELF AS RESULT,
MEMBER FUNCTION isInside (i INTEGER)
RETURN INTEGER
);
CREATE OR REPLACE TYPE BODY BV_OWN.boundary
AS
CONSTRUCTOR FUNCTION boundary
RETURN SELF AS RESULT
IS
BEGIN
v_start := 1;
v_end := 2;
RETURN;
END;
CONSTRUCTOR FUNCTION boundary (i_start INTEGER, i_end INTEGER)
RETURN SELF AS RESULT
IS
BEGIN
v_start := i_start;
v_end := i_end;
RETURN;
END;
MEMBER FUNCTION isInside (i INTEGER)
RETURN INTEGER
IS
BEGIN
IF v_start <= i AND i <= v_end
THEN
RETURN 1;
ELSE
RETURN 0;
END IF;
END;
END;
SELECT ( bv_own.boundary(1,2)) FROM DUAL; --doesn't work
[Error] Execution (2: 10): ORA-06553: PLS-307: too many declarations of ‘BOUNDARY’ match this call
SELECT ( bv_own.boundary()).isInside(1) FROM DUAL; --is working
1
[ad_2]