select LTRIM( SUBSTR( MAX( SYS_CONNECT_BY_PATH( COLUMN_NAME, ', ') ), 2 ) ) as "OUTPUT_COLUMN" 
from ( 
    select 1 as INDEX_NO, 'AAA' as COLUMN_NAME FROM DUAL
    union all
    select 2 as INDEX_NO, 'BBB' as COLUMN_NAME FROM DUAL
    union all
    select 3 as INDEX_NO, 'CCC' as COLUMN_NAME FROM DUAL )
start with INDEX_NO = 1 
connect by prior INDEX_NO = INDEX_NO - 1

위와 같은 쿼리로 각 Row의 데이터를 하나의 Row로 출력할 수 있다.
2009/03/24 16:52 2009/03/24 16:52

덧글을 달아 주세요