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!

Select from a VARRAY with a structured data type?

Rodney ChanDec 13 2010 — edited Dec 16 2010
Im trying to figure out how to access or query a table that is set up as follows

Student table

Columns

stuid
name(firstm last) ->This column is set up as a "structured type"
bdate
program
areas(area, depth)->This is set up as a VARRAY

In the schema for the above table, the data type of "name" is a structured data type (containing two strings, first and last) and "areas" should be declared as a varying array of 3 entries (each entry consisting of two fixed strings, area and depth).

I was able to find info on how to query a table with a VARRAY column (had to do with casting or creating a view), but Im not sure how to query for the column "areas" as this is set up as a VARRAY with a further layer of a structured type.

So my code looks some what like this

CREATE OR REPLACE TYPE AREAS_TYPE AS OBJECT (
AREA NUMBER(5),
DEPTH NUMBER(5)
);
/

CREATE OR REPLACE TYPE AREA_VARRAY_TYPE AS VARRAY(3) OF AREAS_TYPE;

Is this even possible?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 13 2011
Added on Dec 13 2010
3 comments
566 views