Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL Script to Export Query Results to Excel

530085Aug 25 2006 — edited Aug 25 2006
I want to export query results from a database query to Excel. I have seen several threads saying do this:

SQL>spool c:\results.csv
SQL>query
SQL>spool off

That would be a good solution, but I am trying to automate a script so a non-technical user can do it. I want them to just enter one command, and they get the results from the query in Excel. They will not be entering commands at the command line one at a time (like above), they will just run 1 script.

When I try to add the code above to a script, it writes to the current directory with a file named c:\results.csv . Obviously that's not where I want it to go or how I want it named. I want it in the c: directory with the name results.csv .

Any ideas? Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 22 2006
Added on Aug 25 2006
4 comments
2,146 views