select decode(a.col3, null, a.col1, b.col1) col1,
decode(a.col3, null, a.col1, b.col1) col2,
decode(a.col1, null, a.col3, b.col3) col3,
decode(a.col2, null, a.col4, b.col4) col4,
a.col5 col5
from a, b
where NVL(a.col1, '%') = NVL(b.col1(+), '%')
and NVL(a.col2, '%') = NVL(b.col2(+), '%')
and NVL(a.col3, '%') = NVL(b.col3(+), '%')
and NVL(a.col4, '%') = NVL(b.col4(+), '%')
|