Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Object Types in PL/SQL
Hi list
I have a problem regardint PL/SQL Object Types. According to the fine
manual, it should be
possible to override the default constructor (I'm on 9.2.0.3.0 Win2k). I did
that, Object Type
compiles without complaints:
CREATE OR REPLACE TYPE tVNR AS OBJECT
(
vVNR VARCHAR2(14),
CONSTRUCTOR FUNCTION tVNR(piVNR VARCHAR2)
RETURN SELF AS RESULT,
MEMBER FUNCTION getVNR
RETURN VARCHAR2
) INSTANTIABLE FINAL;
CREATE OR REPLACE TYPE BODY tVNR AS
CONSTRUCTOR FUNCTION tVNR(piVNR VARCHAR2)
RETURN SELF AS RESULT IS
BEGIN
IF (LENGTH(piVNR)=11) THEN
SELF.vVNR := SUBSTR(piVNR,1,4) || '.' || SUBSTR(piVNR,5,4) || '.' ||
SUBSTR(piVNR,9,3);
ELSE
SELF.vVNR := 'invalid';
END IF;
RETURN;
END;
MEMBER FUNCTION getVNR RETURN VARCHAR2 IS
BEGIN
RETURN SELF.vVNR;
END;
END;
Now, everytime I want to create an object like this:
declare
vVNR tVNR;
begin
vVNR := new tVNR('12345678901');
dbms_output.put_line(vVNR.getVNR());
end;
I get the following error message:
ERROR at line 4:
ORA-06550: line 4, column 15: PLS-00307: too many declarations of 'TVNR' match this call ORA-06550: line 4, column 3:
Looks to me like the PL/SQL enginge isn't able to distinguish the default
constructor from the
overridden (my) version, since they have the same signature (of course).
Any input ? I couldn't find ANY descenct hints in the fine manual or the Received on Tue Jul 15 2003 - 04:52:20 CDT
![]() |
![]() |