Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, santhoshreddy.

Asked: November 21, 2016 - 4:17 am UTC

Last updated: November 21, 2016 - 9:17 am UTC

Version: 11g

Viewed 1000+ times

You Asked

Hi,

I would like to export the result of a query run on SQL * Plus Toll into a file format like notepad,Excel.
Is It possible? If not Possible Are there any tolls rather than SQL*PLUS?

Thank you.

and Chris said...

Notepad isn't a file format! It can read any text files.

You can export your results to files from SQL*Plus using spool:

http://docs.oracle.com/database/121/SQPUG/ch_twelve043.htm#SQPUG126

But if you're looking for a command line tool, I'd recommend checking out SQLcl:

http://www.oracle.com/technetwork/developer-tools/sqlcl/overview/index.html

This has several options for formatting your output using SQLFORMAT. See this video for a quick demo (go to 7m 10s):



If you prefer a GUI, SQL Developer also has numerous options. Including exporting to Excel (xls) files.

Is this answer out of date? If it is, please let us know via a Comment