?
Solved

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

Posted on 2014-11-22
7
Medium Priority
?
57 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
[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
7 Comments
 
LVL 38

Expert Comment

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

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 672 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 664 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 29

Assisted Solution

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

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 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 41649007
There are answers given here, I suggest as solution https:#a40459385 with assist for https:#40459439 and https:#a40462760
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
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…
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.
Via a live example, show how to take different types of Oracle backups using RMAN.
Suggested Courses

800 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