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!

How to convert row into column

3350986Jan 16 2017 — edited Jan 16 2017

Hi All,

Can you give any idea about the below requirement.

I have the table like below.

CREATE TABLE TESTING1

(

C1 VARCHAR2(50),

C2 VARCHAR2(50),

C3 VARCHAR2(50) ,

C4 VARCHAR2(50)

);

Insert into TESTING1 (C1,C2,C3,C4) values
('EMPNO','ENAME','SAL','DEPTNO');

Insert into TESTING1 (C1,C2,C3,C4) values
('100','BALU','1000','10');

Insert into TESTING1 (C1,C2,C3,C4) values
('200','RAVI','2000','20');

COMMIT;

select *from TESTING1;

pastedImage_1.png

Here columns are C1, C2, C3, C4

and

data is like below

EMPNO ENAME SAL DEPTNO

100 BALU 1000 10

200 RAVI 2000 20

we want to show 1st row as columns and from 2nd
row onwards we have to considered data like below

pastedImage_0.png

In our project i have 250 columns for above the requirement.

Regards,

Sirish

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 13 2017
Added on Jan 16 2017
6 comments
175 views