OBJECT TYPE Body creation ERROR [message #682184] |
Thu, 08 October 2020 04:15 |
Bilal Khan
Messages: 128 Registered: April 2010 Location: Pakistan
|
Senior Member |
|
|
i want to create object type body but it display compilation error.
first i create 2 VARRAY Type
CREATE OR REPLACE TYPE skills AS VARRAY(5) OF VARCHAR(5);
CREATE OR REPLACE TYPE certification AS VARRAY(5) OF VARCHAR(5);
then i create studentType object type
CREATE OR REPLACE TYPE students AS OBJECT(
name VARCHAR(15),
address VARCHAR(15),
skill SKILLS,
certi CERTIFICATION,
MAP MEMBER FUNCTION getAddress RETURN VARCHAR,
MAP MEMBER FUCNTION getName RETURN VARCHAR);
after successfully creation of object type studentType i create object body but it display error message.
following is the code for type body.
CREATE OR REPLACE TYPE BODY studentType IS
MEMBER FUNCTION getName RETURN VARCHAR2 IS
BEGIN
RETURN name;
END;
END;
/
but it display error message
Warning: Type Body created with compilation errors.
Please help me in this regards.
|
|
|
Re: OBJECT TYPE Body creation ERROR [message #682186 is a reply to message #682184] |
Thu, 08 October 2020 05:35 |
|
Michel Cadot
Messages: 68665 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
SQL> CREATE OR REPLACE TYPE skills AS VARRAY(5) OF VARCHAR(5);
2 /
Type created.
SQL> CREATE OR REPLACE TYPE certification AS VARRAY(5) OF VARCHAR(5);
2 /
Type created.
SQL> CREATE OR REPLACE TYPE students AS OBJECT(
2 name VARCHAR(15),
3 address VARCHAR(15),
4 skill SKILLS,
5 certi CERTIFICATION,
6 MAP MEMBER FUNCTION getAddress RETURN VARCHAR,
7 MAP MEMBER FUCNTION getName RETURN VARCHAR);
8 /
Warning: Type created with compilation errors.
SQL> sho err
Errors for TYPE STUDENTS:
LINE/COL ERROR
-------- -------------------------------------------------------------------------------------
7/15 PLS-00103: Encountered the symbol "FUCNTION" when expecting one of the following:
function procedure
The symbol "function was inserted before "FUCNTION" to continue.
SQL> CREATE OR REPLACE TYPE BODY studentType IS
2 MEMBER FUNCTION getName RETURN VARCHAR2 IS
3 BEGIN
4 RETURN name;
5 END;
6 END;
7 /
Warning: Type Body created with compilation errors.
SQL> sho err
Errors for TYPE BODY STUDENTTYPE:
LINE/COL ERROR
-------- -------------------------------------------------------------------------------------
0/0 PL/SQL: Compilation unit analysis terminated
1/11 PLS-00201: identifier 'STUDENTTYPE' must be declared
1/11 PLS-00304: cannot compile body of 'STUDENTTYPE' without its specification
The first error is obvious.
The second one requires you post the COMPLETE code you're trying to execute.
[Updated on: Thu, 08 October 2020 05:56] Report message to a moderator
|
|
|
Re: OBJECT TYPE Body creation ERROR [message #682189 is a reply to message #682186] |
Thu, 08 October 2020 05:47 |
Bilal Khan
Messages: 128 Registered: April 2010 Location: Pakistan
|
Senior Member |
|
|
thanks dear for helping me. now its working
CREATE OR REPLACE TYPE BODY studentType IS
MEMBER FUNCTION getName RETURN VARCHAR2 IS
BEGIN
RETURN name;
END;
MEMBER FUNCTION getAddress RETURN VARCHAR2 IS
BEGIN
RETURN address;
END;
END;
/
|
|
|
|