why the constructor not compiling
575729Feb 22 2008 — edited Feb 22 2008hi
I have created an object but its constructor is not compiling. here is the code example
CREATE OR REPLACE TYPE person AS OBJECT
(
empno NUMBER(4),
ename VARCHAR2(10),
job VARCHAR2(9),
mgr NUMBER(4),
hiredate DATE,
sal NUMBER(7, 2),
comm NUMBER(7, 2),
deptno NUMBER(2),
/*declaring the properties*/
CONSTRUCTOR FUNCTION person RETURN SELF AS RESULT,
MEMBER FUNCTION setaddress(x NUMBER) RETURN VARCHAR2,
MEMBER PROCEDURE setname(n VARCHAR2)
)
;
CREATE OR REPLACE TYPE BODY person IS
--
CONSTRUCTOR FUNCTION person RETURN SELF AS RESULT AS
BEGIN
RETURN NULL;
END;
--
MEMBER FUNCTION setaddress(x NUMBER) RETURN VARCHAR2 IS
BEGIN
RETURN NULL;
END;
--
MEMBER PROCEDURE setname(n VARCHAR2) IS
BEGIN
NULL;
END;
--
END;
gives error
Compilation errors for TYPE SCOTT.PERSON
Error: PLW-07203: parameter 'SELF' may benefit from use of the NOCOPY compiler hint
Line: 13
Text: CONSTRUCTOR FUNCTION person RETURN SELF AS RESULT,
Error: PLS-00658: constructor method name must match type name
Line: 13
Text: CONSTRUCTOR FUNCTION person RETURN SELF AS RESULT,
Error: PLW-07203: parameter 'SELF' may benefit from use of the NOCOPY compiler hint
Line: 15
Text: MEMBER PROCEDURE setname(n VARCHAR2)