It depends. Is there a fixed number of columns in this view, or does it depend on what is in the tables? Views, like tables, cannot have a variable column list.
If the only "des" values were rvt, rnt and jvt then a view could be built like this:
create or replace view v as
select pool.id, pool.name,
from pool, pool_st
where pool.id = pool_st.id
group by pool.id, pool.name;
Obviously, this could be extended to any finite list of des values - but those values would have to be known when the view was built.
Originally posted by lynden.zhang
I think you should be able to solve this problem by using user-defined aggregate function. In that way you don't have to use hard-coded decode. Here is a link of a silimar post: