Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Pivot help

donovan7800Jun 5 2014 — edited Jun 5 2014

Say so I have simple data like this:

CREATE TABLE assembly

(

assy_no VARCHAR(30),

assy_bld VARCHAR(30)

);

INSERT INTO assembly SELECT '12345H','235ASD33' FROM dual;

INSERT INTO assembly SELECT '5AS352','YV457SS2' FROM dual;

INSERT INTO assembly SELECT 'GFDG42','887AVNSA' FROM dual;

SELECT * FROM assembly;

ASSY_NO    ASSY_BLD

---------- ----------

12345H     235ASD33  

5AS352     YV457SS2  

GFDG42     887AVNSA  

          

I want it to look like this:


COL_1       COL_2      COL_3      COL_4

--------    --------   --------   --------

ASSY_NO     12345H     5AS352     GFDG42    

ASSY_BLD    235ASD33   YV457SS2   887AVNSA  


I don't really care what the names of the column headers are, I just want to have each table column on it's own row with the their values showing horizontally across.


I'm not that sure how to do that with PIVOT but I assume it's possible?


Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 3 2014
Added on Jun 5 2014
1 comment
679 views