• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 63
  • Last Modified:

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

in oracle 10g how to convert  the output of ' select * from emp' to excel file
0
priya saxena
Asked:
priya saxena
3 Solutions
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Are you using sqlplus or some graphical development environment? On which OS?
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
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
 
Steve WalesSenior Database AdministratorCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MikeOM_DBACommented:
When using SQL*Plus, you can create XML files which are easily imported into Excel.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
There are answers given here, I suggest as solution https:#a40459385 with assist for https:#40459439 and https:#a40462760
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now