I donโt think there is anywhere in the documentation that guarantees the order that the data will be returned.
There exists an old Tom Kyte theme from 2003 (it may be outdated), which says that relying on implicit order is not recommended, for the same reasons that you will not rely on order in regular SQL.
1st: the order of the rows returned from the table function inside the SQL statement is the exact same order in which the records were โskippedโ to the internal collection (so that the order by clause is not required)?
...
Follow-up May 18, 2003 - 10:00 UTC:
1) maybe, maybe not, I would not count on it. You should not count the order of the rows in the result set without order. If you are joining or doing something more complicated, then just select "select" from table (f (x)) ", the rows could return in a different order.
empirically - they seem to return when they are piped. I do not believe that this is documented, that it is.
In fact, collections of type NESTED TABLE are documented explicitly that do not have the ability to maintain order.
To be safe, you should do as always, in the request, specify an explicit ORDER BY if you want the results of the request to be ordered.
Having said that, I took your function and launched 10 million iterations to check if the implicit order was broken; this is not true.
SQL> begin 2 for i in 1 .. 10000000 loop 3 for j in ( SELECT a.*, rownum as rnum FROM table(temp_func()) a ) loop 4 5 if jx <> j.rnum then 6 raise_application_error(-20000,'It broke'); 7 end if; 8 end loop; 9 end loop; 10 end; 11 / PL/SQL procedure successfully completed.