Solved

sqlplus not showing column names

Posted on 2009-04-01
5
2,866 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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 …
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

726 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