Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 Conntect by problem SQL: 1. The most common method of connect by is www.2cto.com select SYS_CONNECT_BY_PATH (sal, ',') from (select sal, ROW_NUMBER () over (partition by deptno order by sal) rn, ROW_NUMBER () over (partition by deptno order by sal)-1 as dn from scott. emp where deptno = '20') start with rn = 1 connect by prior rn = dn display result:, random, 1200, 1650,1200, 1650,446 2.5, 12 4462.5, 1650,446, 4500,1200, 2.5, 4500,4500 no problem 2: select SYS_CONNECT_BY_PATH (sal, ',') from (select sal, ROW_NUMBER () over (order by sal) rn, ROW_NUMBER () over (order by sal)-1 as dn from scott. emp where deptno = '20') start with rn = 1 connect by prior rn = dn: the result is the same as the preceding one. Statement 3: with ss as (select sal, ROW_NUMBER () over (partition by deptno order by sal) rn, ROW_NUMBER () over (partition by dept No order by sal)-1 as dn from scott. emp where deptno = '20') select SYS_CONNECT_BY_PATH (sal, ',') from ss start with rn = 1 connect by prior rn = dn result: Same as above: with ss as (select sal, ROW_NUMBER () over (order by sal) rn, ROW_NUMBER () over (order by sal)-1 as dn from scott. emp where deptno = '20') select SYS_CONNECT_BY_PATH (sal, ',') from ss start with rn = 1 connect by prior rn = dn result:, random, 12 The results showed that only 2 recursion was performed.