Order in unnested varray
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.