There's three things you need determine when unpivoting:
1. The name of a new column that will store the values from the original columns
2. The name of another column showing the source of these values
3. The list of columns that hold the values you want to become rows
Oracle Database excludes null values automatically. To remove duplicates, all you need to do is use distinct on the column from 1 and any others you're not unpivoting:
with rws as (
select 1 x, 'ABC' c1, 'DEF' c2, 'GHI' c3 from dual union all
select 2 x, 'ABC' c1, 'DEF' c2, 'DEF' c3 from dual union all
select 3 x, 'ABC' c1, null c2, null c3 from dual
)
select distinct x, val from rws
unpivot (
val for col in (c1, c2, c3)
)
order by 1, 2;
X VAL
1 ABC
1 DEF
1 GHI
2 ABC
2 DEF
3 ABC
For more about unpivot, see:
https://blogs.oracle.com/sql/entry/how_to_convert_rows_to#unpivot