id a
--------------
01 r1
01 r2
01 r3
02 r1
02 r3
03 r1
03 r2
------解决方案--------------------
select * from (
select id, decode(lvl, 1, a1, 2, a2, 3, a3) as a
from t, (select level lvl from dual connect by level <= 3)
) where a is not null order by id, a;