Pages

Tuesday, December 6, 2011

How to export query result in oracle

In may times, we often want to export the query results in the oracle into a text file with a specific format. In this blog we will discuss about how to export query results in the oracle into a text file.
To do so run the following script:
set head off 
spool c:\myoracle.txt
select field1||', '||field2||', '||field3 from my_table;
spool off
set head on
Notes :
This script will create a comma delimited file named: c:\myoracle.txt
Make sure you replace "my_table" with the actual table name.
And replace the field1, field2, with your column names.

No comments:

Post a Comment

Don't Forget To Join Our Community
×
Widget