Hi all,
I have the following code, and I am getting the following error. I want to have a constructor that can be called without specifying the parameters by name. Is that not possible?
What am I doing wrong?
Thanks!
Error:
Error at line 50
ORA-06550: line 5, column 17:
PLS-00307: too many declarations of 'TRANSFEROBJECT_O' match this call
ORA-06550: line 5, column 5:
PL/SQL: Statement ignored
Code:
DROP TYPE TransferObject_o
/
CREATE TYPE
TransferObject_o
AS OBJECT
(
m_objectId NUMBER(15)
, m_attribute VARCHAR2(4000)
, CONSTRUCTOR FUNCTION TransferObject_o
(
p_objectId NUMBER-- := NULL
, p_attribute VARCHAR2-- := NULL
) RETURN SELF AS RESULT
);
/
CREATE TYPE BODY
TransferObject_o
AS
CONSTRUCTOR FUNCTION TransferObject_o
(
p_objectId NUMBER-- := NULL
, p_attribute VARCHAR2-- := NULL
) RETURN SELF AS RESULT
IS
BEGIN
SELF.m_objectId := p_objectId;
SELF.m_attribute := p_attribute;
RETURN;
END;
END;
/
DECLARE
l_object TransferObject_o;
BEGIN
l_object := TransferObject_o(1, 'B');
END;
/