Solved

in oracle 10g how to convert  the output of ' select * from emp' to excel file

Posted on 2014-11-22
7
36 Views
Last Modified: 2016-06-11
in oracle 10g how to convert  the output of ' select * from emp' to excel file
0
Comment
Question by:priya saxena
7 Comments
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 40459099
Are you using sqlplus or some graphical development environment? On which OS?
0
 
LVL 37

Accepted Solution

by:
Gerwin Jansen earned 168 total points
ID: 40459385
If you are using sqlplus, you can do this to create a csv file that can be opened by Excel:

spool file.csv
select column1 || ',' ||  column2 ',' || column3
from emp;
spool off

You need to specify every column you want in the above select statement. If you have columns that contain spaces, you could add "" - like this:
(column2 is the one with spaces)

select column1 || ',"' ||  column2 '",' || column3

You can add some settings after the first spool command to get nice output:

set headsep off
set echo off
set feedback off
set linesize 1000
set pagesize 0
set trimspool on
0
 
LVL 22

Assisted Solution

by:Steve Wales
Steve Wales earned 166 total points
ID: 40459439
I normally find that for a simple query that it's easier to open Excel and import directly from MS Query.   You launch Excel, Select Data / Import External Data and then you can connect to an ODBC Data Source via the wizard that launches and it will guide you through.

Alternatively you can also use a tool Oracle SQL Developer (free)  or a paid tool like PL/SQL Developer to run the query and then export the result grid directly to Excel.
0
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.

 
LVL 29

Assisted Solution

by:MikeOM_DBA
MikeOM_DBA earned 166 total points
ID: 40462760
When using SQL*Plus, you can create XML files which are easily imported into Excel.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 41649006
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 41649007
There are answers given here, I suggest as solution https:#a40459385 with assist for https:#40459439 and https:#a40462760
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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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.

757 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

18 Experts available now in Live!

Get 1:1 Help Now