select
case when col2 = 'Y' then col2
.....
......
end xx
from
(SELECT phon.number col1,phon.primary col2
FROM phones phon, customers cust
WHERE phon.customer_id (+)= cust.customer_id
)