how to accomplish that - using CASE (or decode). The caveats are
o the NAME of that selected attribute will be constant (you will decide that name when you write the query).
o the datatypes of the underlying columns had better be compatible
Those caveats are immutable.
The query would look like:
select a, b,
case myfunction when 1 then c1 when 2 then c2 ... end DATA,
myfunction NAME_OF_DATA
from t
It has to be that way - one of the reasons is that the choice of a column selected from a table can and will change query plans. A query plan is developed before the query is executed. If the query must partially execute to figure out what columns it would be selecting..... We have a chicken and egg problem. The other problem is that IN GENERAL the result from myfunction could change in the middle of a query - meaning the plan would have to change midstream - that is just not possible.
The alternative would be to use dynamic sql.
You would
a) execute myfunction
b) use the output of that to construct a query referencing the column explicitly