Thursday, April 10, 2008

Ho To Export Oracle Query Result to Flat File using Batch File

1.       Create a file (.sql file) with content :

set define off

set head off

set feedback off

set echo off

set pagesize 0

set pages 0

set linesize 200

set timing off

 

[put your query here];

exit;

2.       Open your command prompt:

Start > Run => type “cmd”

3.       Go to your oracle directory

4.       Type : “type [your query file] | SQLPLUS -s [username]/[password]@[host]  > [your output file]”