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!

Order in unnested varray

320607Aug 28 2002
Suppose I have a table PEOPLE that contains two columns: One with a NAME and one with a VARRAY PHONE_NUMBERS. Now I'm using the following SQL query to unnest (flatten) the VARRAY in this table:

SELECT e.NAME, m.* FROM PEOPLE e, TABLE(e.PHONE_NUMBERS) m;

The result is a flat table with two columns: one in which each NAME occurs as many times as there are PHONE_NUMBERS for that NAME, and one with all PHONE_NUMBERS.

What I want to know now is, are all records of the original table grouped together in the resulting table and do the PHONE_NUMBERS occur in the same order as they were originally stored in the VARRAYs? Or is there a chance that the TABLE operator in the query above mixes things up?

Thanks for your help,

Remco Braak
Adogis BV Amsterdam
The Netherlands

PS: It could be that the SQL query above could be simpler (no aliases), but in reality, I'm working with an Oracle Spatial table which involves object types AND varrays. That I'm working with Oracle Spatial should also explain why I'm so concerned whether the order of the varrays is maintained after unnesting.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 7 2002
Added on Aug 28 2002
6 comments
456 views