WITH t(type, name, code) AS
(
SELECT '과일', '사과', '0' FROM dual
UNION ALL SELECT '과일', '레몬', '1' FROM dual
UNION ALL SELECT '과일', '포도', '2' FROM dual
UNION ALL SELECT '과일', '참외', '3' FROM dual
UNION ALL SELECT '채소', '오이', '0' FROM dual
UNION ALL SELECT '채소', '당근', '1' FROM dual
UNION ALL SELECT '채소', '호박', '2' FROM dual
)
SELECT type
, SUBSTR(XMLAgg(XMLElement(x, ',', name) ORDER BY code).Extract('//text()'), 2) name_9i
, wm_concat(name) name_10g
, ListAgg(name, ',') WITHIN GROUP(ORDER BY code) name_11g
FROM t
GROUP BY type
ORDER BY type;
'wif LiNoUz > Oracle,Sql' 카테고리의 다른 글
오라클에서 is_number, is_date 함수 사용하기 (0) | 2014.04.21 |
---|---|
오라클 캐릭터셋 짜증 (1) | 2013.05.15 |
시간계산 쿼리 (0) | 2013.03.18 |
install oracle 11g on suse11 sp1 (0) | 2013.03.07 |
SLSE 11에 오라클 설취 (0) | 2013.03.07 |