Solved

sqlplus not showing column names

Posted on 2009-04-01
5
2,940 Views
Last Modified: 2013-12-18
I have a query that returns all the columns from my DB base on the provided criteria.  The problem is that there are 81 columns and I need to see which values correspond to each column name.

The query is as folows:
 set colsep ,
set heading on
set feedback off
set pagesize 0
set linesize 3000
set trimspool on
spool my_file.csv
select * from doctaba where A33 in (07323910933,07323910934)

I see all the data in the sqlplus output and the csv file, but do not see what column is associated with each value.  My DBA says the only way  to get the column names is by specifying each column individually in the select.  Is this correct?  I really don't want to specify 81 column names.
Thanks
0
Comment
Question by:ckaley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 24040980
the problem is

set pagesize 0

doing that turns off headings, even if you have "set heading on"
0
 

Author Comment

by:ckaley
ID: 24041282
Is there any way to get all the columns to show up on the same line?  The output looks like this?
F_DOCNUMBER,F_DOCCLASSNUMBER,F_ENTRYDATE,F_LASTACCESS,F,F_ARCHIVEDATE,F_PURGEDATE,F_DELETEDATE,F,F,F
A40                                                                                                            
A60                                                                                                            
A72                                                                                                            
A85  

This is carrying over to the csv file.  Unfortunately the created set up all these columns to be VARCHAR2(239) even for fileds that will never see more than 11 characters.                                                                                                          
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 250 total points
ID: 24041324
set the linesize higher.

if that's still not enough, then you'll have to use formatting commands for each column to restrict their width
0
 

Author Closing Comment

by:ckaley
ID: 31565390
Thank you so much for the fast response.  Do you want to come be our DBA? :)  My DBA had no idea about how to do any of this.  Again thank you for saving me from a big headache.
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 24041430
Glad I could help, for more information about using sql*plus commands you can look here...


http://www.oracle.com/pls/db102/to_pdf?pathname=server.102%2Fb14357.pdf&remark=portal+%28Application+development%29


and thanks for the offer, but I'm happy where I am
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question