행위

"오라클 listagg 함수"의 두 판 사이의 차이

DB CAFE

12번째 줄: 12번째 줄:
 
   ) within group (order by cols)  
 
   ) within group (order by cols)  
  
 +
</source>
 +
 +
예시)
 +
<source lang=sql>
 +
select table_name,
 +
        listagg(index_name, ',' on overflow truncate
 +
            'click here'
 +
        ) within group (order by index_name) inds
 +
  from  user_indexes
 +
  group  by table_name;
 
</source>
 
</source>

2019년 7월 19일 (금) 09:32 판

thumb_up 추천메뉴 바로가기


ListAgg

  • Row를 Col로 변경

Syntax (12c 개선)

LISTAGG(
    COLUMN, ','
    [ on overflow (truncate|error) ]
    [ text ] [ (with|without) count ]
  ) within group (order by cols)

예시)

select table_name,
         listagg(index_name, ',' on overflow truncate
            'click here'
         ) within group (order by index_name) inds
  from   user_indexes
  group  by table_name;