Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Access data in UDT within a table

852752Apr 4 2011 — edited Apr 5 2011
I'm new to Oracle and I'm using Oracle Express 10g. I know this must be something really simple but I have a table based on an object and that object also contains attributes which are user defined types.

I have inserted data into the table etc but no matter what select statement I do I can't view the data I have put into the UDT columns.

E.G. if I try and pull the name out using this statement:
SELECT name
FROM student_table

I get the error: ORA-00932: inconsistent datatypes: expected NUMBER got SYSTEM.NAME_T

Name UDT:
CREATE TYPE name_t AS OBJECT(
first_name VARCHAR2(10),
surname VARCHAR2(10));

Create Student Object:
CREATE TYPE student_t UNDER person_t(
enrolment_no VARCHAR2(6),
date_commenced DATE,
programme_ref REF programme_t,
MEMBER FUNCTION year_of_study RETURN NUMBER);

CREATE Student Table:
CREATE TABLE student_table OF student_t(
PRIMARY KEY (person_id));

Any help is greatly appreciated,
Cheers,
Mike
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2011
Added on Apr 4 2011
4 comments
532 views