日期:2014-05-16 浏览次数:20723 次
SELECT LTRIM(MAX(SYS_CONNECT_BY_PATH(T3.NAME, ',')), ',') name
FROM (SELECT ROW_NUMBER() OVER(PARTITION BY T2.RNUM order by 'x') RN,
T2.RNUM,
t1.name
FROM T1 T1,
(SELECT T.RNUM, REGEXP_SUBSTR(T.id, '[^,]+', 1, LEVEL) STR
FROM (SELECT t.id, ROWNUM RNUM FROM T2 T) T
CONNECT BY LEVEL <=
(LENGTH(T.id) - LENGTH(REPLACE(T.id, ',', ''))) /
LENGTH(',') + 1
AND PRIOR RNUM = RNUM
AND PRIOR DBMS_RANDOM.VALUE IS NOT NULL) T2
WHERE T1.ID = T2.STR) T3
START WITH T3.RN = 1
CONNECT BY PRIOR RN = RN - 1
AND PRIOR T3.RNUM = T3.RNUM