Home » SQL & PL/SQL » SQL & PL/SQL » Alter Type Error
Alter Type Error [message #202761] Sat, 11 November 2006 21:18 Go to next message
tlahyani
Messages: 20
Registered: November 2006
Junior Member
Hello - Can anybody see what's wrong with this code:

CREATE OR REPLACE TYPE DepartmentType AS OBJECT (
dno NUMBER,
name VARCHAR2(20),
building VARCHAR2(20),
budget NUMBER
);
/
Type created.

show err;
No errors.


CREATE OR REPLACE TYPE CourseType AS OBJECT (
cno NUMBER,
name VARCHAR2(20),
dept REF DepartmentType,
credits NUMBER
);
/
Type created.

show err;
No errors.



CREATE TYPE course_list AS VARRAY(50) OF REF CourseType;
/
Type created.

show err;
No errors.


ALTER TYPE DepartmentType
add attribute (coursesOffered course_list) CASCADE;
Type altered.

/

ALTER TYPE DepartmentType
*

ERROR at line 1:
ORA-22324: altered type has compilation errors
ORA-22328: object "LAHYANIT"."DEPARTMENTTYPE" has errors.
PLS-00410: duplicate fields in RECORD,TABLE or argument list are not permitted
ORA-06550: line 0, column 0:
PL/SQL: Compilation unit analysis terminated
show err;
No errors.



I don't see any duplicate fields, anybody has a clue what it complains about? Thanks,
Re: Alter Type Error [message #202762 is a reply to message #202761] Sat, 11 November 2006 21:49 Go to previous messageGo to next message
Barbara Boehmer
Messages: 8620
Registered: November 2002
Location: California, USA
Senior Member
You have a semicolon at the end of your alter type command, but then you also added a slash after that. You can see that the type was altered after the semicolon. By adding the slash you re-run the same alter type command, which then attempts to re-add the same attribute. Just remove the last slash from your code. You need both a semicolon and a slash after after create type commands, but not after alter type commands.
Re: Alter Type Error [message #202763 is a reply to message #202761] Sat, 11 November 2006 22:07 Go to previous message
tlahyani
Messages: 20
Registered: November 2006
Junior Member
That worked Smile
I thought I needed a / after the alter statements as well. Thanks a lot.
Previous Topic: To get the first day of the month
Next Topic: SQLLDR SCRIPT
Goto Forum:
  


Current Time: Fri Dec 02 16:50:07 CST 2016

Total time taken to generate the page: 0.43054 seconds