WITH T(val1, val2, val3) AS ( SELECT 'ㄱ','ccc','dd33' FROM DUAL UNION ALL SELECT 'ㄴ','fff','ge22' FROM DUAL UNION ALL SELECT 'ㄷ','ccc','dd33' FROM DUAL UNION ALL SELECT 'A','ccc','dd33' FROM DUAL UNION ALL SELECT 'a','ccc','dd33' FROM DUAL UNION ALL SELECT 'B','ccc','dd33' FROM DUAL ) SELECT val1, val2, val3 FROM T WHERE val1 = '1' UNION SELECT DECODE(COUNT(1), 0, 'asd', MAX(val1)), DECODE(COUNT(1), 0, 'ddd', MAX(val2)), DECODE(COUNT(1), 0, 'aa11', MAX(val3)) FROM T WHERE (val1, val2, val3) IN(SELECT val1, val2, val3 FROM T WHERE val1 = '1' AND ROWNUM = 1)