Home » Infrastructure » Linux » Shell Script to download Data from a Database table to a Flat file (Redhat Linux 5, Oracle 10g)
Shell Script to download Data from a Database table to a Flat file [message #606758] Tue, 28 January 2014 22:48 Go to next message
sonudev
Messages: 18
Registered: November 2009
Location: bangalore
Junior Member
How to write a shell script to download data from a database table to a flat file? I am using Redhat Linux and Oracle 10g.
Thanks for any suggestion.
Re: Shell Script to download Data from a Database table to a Flat file [message #606759 is a reply to message #606758] Tue, 28 January 2014 22:55 Go to previous messageGo to next message
BlackSwan
Messages: 22490
Registered: January 2009
Senior Member
sqlplus scott/tiger
spool emp.txt
select * from emp;
spool off
exit
Re: Shell Script to download Data from a Database table to a Flat file [message #606780 is a reply to message #606758] Wed, 29 January 2014 05:30 Go to previous messageGo to next message
gazzag
Messages: 275
Registered: November 2010
Location: Bristol, UK
Senior Member
sqlplus scott/tiger  << EOI
spool emp.txt
select * from emp;
spool off
EOI

Similar to what Blackswan said. Also, look into the COLSEP system variable depending on how you want the output formatted.

HTH
-g

[edit: formatting]

[Updated on: Wed, 29 January 2014 05:32]

Report message to a moderator

Re: Shell Script to download Data from a Database table to a Flat file [message #607422 is a reply to message #606780] Thu, 06 February 2014 03:08 Go to previous message
sonudev
Messages: 18
Registered: November 2009
Location: bangalore
Junior Member
Thanks BlackSwan and gazzag for giving me hints on this.
Previous Topic: Oracle 11g on Debian wheezy support
Next Topic: Oracle 11 g installation
Goto Forum:
  


Current Time: Thu Jul 24 15:49:09 CDT 2014

Total time taken to generate the page: 0.12408 seconds