Transpose Rows into columns

Transpose Rows into columns

 

  

Hi,

I want to to transpose rows into columns dynamically.

For ex.

SQL> select deptno, dname from dept;
DEPTNO DNAME
---------- --------------
10 ACCOUNTING
20 RESEARCH
30 SALES
40 OPERATIONS

I want the result as
10 20 30 40
ACCOUNTING RESEARCH SALES OPERATIONS

whithout hardcoding the column names.

These row may get increased. As row get inserted a new column will also get generated dynamically.

Suppose there are 50 rows the query will show me the 50 columns in result

Regards,

Mahesh

Oracle LazyDBA home page