Link to home
Start Free TrialLog in
Avatar of ckaley
ckaleyFlag for United States of America

asked on

sqlplus not showing column names

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
Avatar of Sean Stuber
Sean Stuber

the problem is

set pagesize 0

doing that turns off headings, even if you have "set heading on"
Avatar of ckaley

ASKER

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.                                                                                                          
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ckaley

ASKER

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.
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