Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sqlplus not showing column names

Posted on 2009-04-01
5
Medium Priority
?
3,025 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 1000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
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 Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

718 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