1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | WITH tbl_common(val1, text1) AS ( SELECT '01' , '사과' FROM dual UNION ALL SELECT '02' , '배' FROM dual UNION ALL SELECT '03' , '딸기' FROM dual ) , tbl(column1) AS ( SELECT '01,02,03' FROM dual UNION ALL SELECT '01,03' column1 FROM dual ) SELECT column1 , ( SELECT SUBSTR(XMLAGG(XMLELEMENT(x, ',' , text1)).EXTRACT( '//text()' ), 2) FROM tbl_common WHERE a.column1 LIKE '%' ||val1|| '%' ) text2 FROM tbl a ; |