Access data in UDT within a table
852752Apr 4 2011 — edited Apr 5 2011I'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