Tuesday, 5 August 2014

How to print column wise data in rows



It can be done by using UNPIVOT

In Oracle :
SQL>create table udfvalues as
    select 'one' c1, 'two' c2, 'three' c3 from dual;

SQL> select * from udfvalues
unpivot ( val for (source) in
                ( c1 as 'C1',                                                                                                          
                   c2 as 'C2',         
                   c3 as 'C3'  )
                )
/

No comments:

Post a Comment