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!

Getting the column header name in a query result set

3408387May 25 2017 — edited May 26 2017

I want to get the table result set's 1st record should have the column name's then it should follow by the corresponding data.

for example considering emp table my result should be :-

"EMPNO""ENAME""JOB""MGR""HIREDATE""SAL""COMM""DEPTNO"
EMPNOENAMEJOBMGRHIREDATESALCOMMDEPTNO
7839"KING""PRESIDENT"17-11-81500010
7698"BLAKE""MANAGER"783901-05-81285030
7782"CLARK""MANAGER"783909-06-81245010
7566"JONES""MANAGER"783902-04-81297520
7788"SCOTT""ANALYST"756619-04-87300020
7902"FORD""ANALYST"756603-12-81300020
7369"SMITH""CLERK"790217-12-8080020
7499"ALLEN""SALESMAN"769820-02-81160030030
7521"WARD""SALESMAN"769822-02-81125050030
7654"MARTIN""SALESMAN"769828-09-811250140030
7844"TURNER""SALESMAN"769808-09-811500030
7876"ADAMS""CLERK"778823-05-87110020
7900"JAMES""CLERK"769803-12-8195030
7934"MILLER""CLERK"778223-01-82130010

How can i do this using oracle 11g/12c.

Thanks in advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 23 2017
Added on May 25 2017
19 comments
15,284 views