Solved

sqlplus not showing column names

Posted on 2009-04-01
5
2,745 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
  • 3
  • 2
5 Comments
 
LVL 73

Expert Comment

by:sdstuber
Comment Utility
the problem is

set pagesize 0

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

Author Comment

by:ckaley
Comment Utility
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 73

Accepted Solution

by:
sdstuber earned 250 total points
Comment Utility
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
Comment Utility
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 73

Expert Comment

by:sdstuber
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now