Write a SQL to print the rows horizonatally table consist of single field.
[B]Question asked by visitor pooja[/b]
Printable View
Write a SQL to print the rows horizonatally table consist of single field.
[B]Question asked by visitor pooja[/b]
try this -------------->>
with t as
(
(select 'a' col from dual)
union all
(select 'a' col from dual)
union all
(select 'a' col from dual)
union all
(select 'a' col from dual)
union all
(select 'a' col from dual)
)
select
max(decode(rn,1,col))col1,
max(decode(rn,2,col))col2,
max(decode(rn,3,col))col3,
max(decode(rn,4,col))col4,
max(decode(rn,5,col))col5
from
(select col,row_number() over(order by col)rn from t)
order by col