I am using Oracle 9i on Windows XP.
I am trying to complete a tutorial for my Database class and have come across an error which I can't get around. I enter the following code which seems to work:
ALTER TYPE student_type REPLACE AS OBJECT
(FirstName varchar2(15),
LastName varchar2(15),
Address address_type,
Contact contact_type,
DateOfBirth date,
Nationality varchar2(15),
AttendanceMode varchar2(15),
StudentNo varchar2(15),
Userid varchar(15),
FeeStatus varchar2(25),
MEMBER FUNCTION getName RETURN varchar2,
PRAGMA RESTRICT_REFERENCES (getName, WNDS, WNPS, RNDS, RNPS)
)
/
It produces the result "Type altered."
Then I enter the following code to implement my member function:
CREATE TYPE BODY student_type IS
MEMBER FUNCTION getName RETURN VARCHAR2 IS
BEGIN
RETURN (FirstName || '' || LastName);
END;
/
(not sure if I should have the "/" at the end but thats the only way I can get it to run)
and I recieve the following error message:
CREATE TYPE BODY student_type IS
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
I know I already have an object type named student_type but have been given the code to implement my member function by my teacher and assumed it would work.
Any suggestions?
Thanks in advance.
James