Solved

Export Query result inside a procedure to Excel file In Oracle SQL Developer

Posted on 2014-03-12
8
4,797 Views
Last Modified: 2014-12-06
Am using Oracle SQL Developer

Am trying to write a procedure which exports the result of the select query inside to a excel file. It should create a new excel file and write the output on it.

Is there any way to do it? Please suggest.
0
Comment
Question by:manivinesh
8 Comments
 
LVL 7

Assisted Solution

by:Kishan Zunjare
Kishan Zunjare earned 125 total points
ID: 39925578
Export oracle sql output to excel format.

Simple way to convert the sql results to excel format

http://www.genlinux.org/2011/03/converting-oracle-sql-output-to-excel.html
0
 
LVL 12

Assisted Solution

by:praveencpk
praveencpk earned 125 total points
ID: 39925718
You have to use UTL_FILE package to get the outputs in excell sheet. here is the doc for your refference.

https://community.oracle.com/message/11052667

https://community.oracle.com/thread/2286974?start=0&tstart=0

Also you can directly export the output of the SQL statement in SQL Developer using upload option when we right click on the o/p window of SQL developer tool.
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 39926017
>> a procedure
How are you going to run this procedure? From SQL Developer, from a DBMS job, shell script or other way?
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 23

Assisted Solution

by:David
David earned 125 total points
ID: 39926283
Gerwin, the author states up front it's SQL*Developer :)

Because of that, I refer my fellow experts and the asker to that tool's "secret" hints.  Manual formatting of the output can be replaced with a short string.  From the source:
Capture.PNG
0
 

Author Comment

by:manivinesh
ID: 39928089
Dear Experts,
Thanks to all your suggestions, It's kind of complicated to me... Let me be more specific...

Tables : Employee, EmployeeReport

1. I need to create one excel/csv file for each employee
2. Am trying to loop the Employee Table through Cursor and inside the loop,
3. I want to write a select query to EmployeeReport, the result set of this query has to be exported to csv/excel file.
0
 
LVL 31

Accepted Solution

by:
awking00 earned 125 total points
ID: 40053907
I've always found it easier to open up Excel and import the database query rather than the other way around. In
Excel, select Data, Import External Data, New Database Query, connect to the database, then follow the query wizard.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mySql Syntax 7 32
Sql server lock cursor 13 41
Group by and order by clause 28 36
Database Containment - Benefits 6 26
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

762 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

21 Experts available now in Live!

Get 1:1 Help Now