Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Member Funtion Error

Member Funtion Error

From: James <Jimbo_at_yahoo.com>
Date: Sat, 15 Nov 2003 19:39:57 +0000 (UTC)
Message-ID: <bp5ved$sk6$1@sparta.btinternet.com>


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 Received on Sat Nov 15 2003 - 13:39:57 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US