Home » Infrastructure » Unix » Data Spool (UNIX)
Data Spool [message #389094] Fri, 27 February 2009 04:49 Go to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

I have written one .sql file. This file will retrieve more than 100000 reocrds. I want to spool this data to some script file.
can you please let me know how to write the script.
I have written "asdf.sql". If I execute this it will retrieve the records. I want to spool the data in test_spool.ksh file
please help me in this.

Thank you
Re: Data Spool [message #389100 is a reply to message #389094] Fri, 27 February 2009 05:03 Go to previous messageGo to next message
Michel Cadot
Messages: 60008
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What about "spool" command?

Regards
Michel
Re: Data Spool [message #389110 is a reply to message #389100] Fri, 27 February 2009 05:39 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

echo "
SET heading off;
SET echo off;
SET verify off;
SET feedback off;
SET linesize 5000;
SET pagesize 0;
SET trims on;
SPOOL test_output.txt CRE
@../sql/spool_test.sql;
SPOOL off
EXIT;" | sqlplus -s TEMP/dev@OS01.

If I am trying to execute the script it's giving the O/P on the scree, But I need the result in test_output.txt file.so data should be spool in the .txt file.

Please let me know .,
Re: Data Spool [message #389122 is a reply to message #389110] Fri, 27 February 2009 05:56 Go to previous messageGo to next message
Michel Cadot
Messages: 60008
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It is ALSO in the spool.

Regards
Michel
Re: Data Spool [message #389130 is a reply to message #389122] Fri, 27 February 2009 06:12 Go to previous messageGo to next message
babuknb
Messages: 1734
Registered: December 2005
Location: NJ
Senior Member

SQL> spool D:\babu_test_spool.txt
SQL> select * from dual;

D
-
X

SQL> spool off
SQL>
SQL> host type D:\babu_test_spool.txt
SQL> select * from dual;

D

-

X


SQL> spool off
Re: Data Spool [message #389132 is a reply to message #389130] Fri, 27 February 2009 06:27 Go to previous message
Michel Cadot
Messages: 60008
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
And what does this show?
Explain IN DETAILS what is your point.

Regards
Michel
Previous Topic: sql script from sh script.
Next Topic: Database Version
Goto Forum:
  


Current Time: Sat Dec 20 18:12:26 CST 2014

Total time taken to generate the page: 0.06876 seconds