tags:

views:

97

answers:

1

Hi, Please help me to achieve the below problem:
I am having one "view" in the Oracle database,I want the output of that view and store that output in the .txt file on some other folder in UNIX box.

The output which is generated from view is a report and I want to save that report in .txt format in one folder on UNIX box.Oracle is present on the UNIX box.

+1  A: 

I thought you might be able to use data pump, but maybe the easiest way is to just run this into the standard oracle sql command line app like:

set long 10000
set termout off
set trimspool off
set feedback off
set heading off

spool test.txt
select a ||','||b||','||c from myview;

spool off;

If you put this in a file called extractSql.sql, then you could run: ${ORACLE_HOME}/bin/sqlplus -L ${USER}/${PASS}@${DB_SERVER} @extractSql.sql

Egwor