--螳 襴蠍 --================== /* 覓語: http://www.soqool.com/servlet/board?cmd=view&cat=100&subcat=1010&seq=94&page=1&position=1 企 test螳 螳 譯殊伎 , WITH TEST AS ( SELECT 'a' col1, 2 col2 FROM DUAL UNION ALL SELECT 'b', 3 FROM DUAL UNION ALL SELECT 'c', 4 FROM DUAL) 螳, 螳 襯 col2 襷 れ 豢ロ 貎朱Μ襯 襷れ 覲伎. col1 col2 --------- a 1 a 2 b 1 b 2 b 3 */ --願 譬. WITH TEST AS ( SELECT 'a' col1, 2 col2 FROM DUAL UNION ALL SELECT 'b', 3 FROM DUAL UNION ALL SELECT 'c', 4 FROM DUAL) SELECT COL1 , COL2 FROM TEST A INNER JOIN (SELECT LEVEL SEQ FROM DUAL CONNECT BY LEVEL <= 1000) B ON B.SEQ <= A.COL2 ORDER BY 1 --覲襦 譬. WITH TEST AS ( SELECT 'a' col1, 2 col2 FROM DUAL UNION ALL SELECT 'b', 3 FROM DUAL UNION ALL SELECT 'c', 4 FROM DUAL) SELECT COL1 , COL2 , RowNo FROM( SELECT COL1 , COL2 , ROW_NUMBER() OVER(PARTITION BY COL1 ORDER BY COL1) RowNo FROM TEST CONNECT BY LEVEL <= COL2) T WHERE RowNo <= COL2