Per SQL Cookbook and practice, the follow code produces the following Cartesian product result:
Table "emp" contains an ename="KING" and Table T10 has been filled with increasing numerics 1..10.
SELECT ename, iter.pos
FROM (SELECT ename FROM emp WHERE ename='KING") e
, (SELECT id AS pos FROM T10) iter ;
WHY does this 'necessarily' come out in numerical order?
I haven't tried it, but wouldn't a different ordering of Table10's IDs produce diff results?
Of course in this subset of a solution, different number ordering doesn't matter, but what I'm after is assurance that they will always be in order.
Looking below you'll see why ordering is important.
My concern is ordering correlated subquery's results doesn't always seem to preserve that ordering upon the final answer.
For those interested, and to understand why I want to know this, the entire solution is below. The purpose will be obvious.
SELECT substr(e.ename, iter.pos) AS "lopping from front"
, substr(e.ename, length(e.ename)-iter.pos+1) AS "appending from end"
FROM (SELECT ename from emp where ename = 'KING') e
, (SELECT id AS pos from t10) iter
WHERE iter.pos <= length(e.ename) ;