Unix Technical Forum

Spool Question

This is a discussion on Spool Question within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I have been asked to export some oracle tables to text files. The main problem I am having is ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 11:56 AM
CriticalJ@gmail.com
 
Posts: n/a
Default Spool Question

I have been asked to export some oracle tables to text files. The main
problem I am having is the resulting file.

The sql for the requested fields is stuck at the top of the file and
spool off is at the bottom.

I have used Set ECHO OFF at the top of the command as well as several
other set commands but nothing seems to stop this.

The solution is probably easy but I am not a regular Oracle user so it
is eluding me. If anyone could direct me to a solution, I would
appreciate it greatly.

Thank you.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 11:56 AM
Lisa Ashley Rafter
 
Posts: n/a
Default Re: Spool Question

Try this...
SQL> set pages 0
SQL> set heading off
SQL> set feedback off
SQL> spool yourfilename.txt
SQL> select * from your_table_here;
SQL> spool off
SQL> set feedback on
SQL> set heading on



CriticalJ@gmail.com wrote:
> I have been asked to export some oracle tables to text files. The main
> problem I am having is the resulting file.
>
> The sql for the requested fields is stuck at the top of the file and
> spool off is at the bottom.
>
> I have used Set ECHO OFF at the top of the command as well as several
> other set commands but nothing seems to stop this.
>
> The solution is probably easy but I am not a regular Oracle user so it
> is eluding me. If anyone could direct me to a solution, I would
> appreciate it greatly.
>
> Thank you.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 11:56 AM
cumin
 
Posts: n/a
Default Re: Spool Question


CriticalJ@gmail.com wrote:
> I have been asked to export some oracle tables to text files. The main
> problem I am having is the resulting file.
>
> The sql for the requested fields is stuck at the top of the file and
> spool off is at the bottom.
>
> I have used Set ECHO OFF at the top of the command as well as several
> other set commands but nothing seems to stop this.
>
> The solution is probably easy but I am not a regular Oracle user so it
> is eluding me. If anyone could direct me to a solution, I would
> appreciate it greatly.
>
> Thank you.


I use Tom Kyte's method to make text files:
http://asktom.oracle.com/pls/ask/f?p...ID:68212348056

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 11:56 AM
CriticalJ@gmail.com
 
Posts: n/a
Default Re: Spool Question

Thank you for the reply.

I tried your suggestions.

At first I tried them in SQL Plus Worksheet. No matter what
combinations I used, I could not get it to work.

Finally, I tried SQL Plus. After experimenting for a while, I finally
got the data to export to a text file.

As a follow up question, is it possible to get column headers for this
data? Everytime I tried this, it failed miserably. This seems like it
should be easier than what I am making it.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 11:56 AM
CriticalJ@gmail.com
 
Posts: n/a
Default Re: Spool Question

Thanks. I'll look into this as well.

J
cumin wrote:
> CriticalJ@gmail.com wrote:
> > I have been asked to export some oracle tables to text files. The main
> > problem I am having is the resulting file.
> >
> > The sql for the requested fields is stuck at the top of the file and
> > spool off is at the bottom.
> >
> > I have used Set ECHO OFF at the top of the command as well as several
> > other set commands but nothing seems to stop this.
> >
> > The solution is probably easy but I am not a regular Oracle user so it
> > is eluding me. If anyone could direct me to a solution, I would
> > appreciate it greatly.
> >
> > Thank you.

>
> I use Tom Kyte's method to make text files:
> http://asktom.oracle.com/pls/ask/f?p...ID:68212348056


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-08-2008, 11:56 AM
sybrandb
 
Posts: n/a
Default Re: Spool Question


CriticalJ@gmail.com wrote:
> Thank you for the reply.
>
> I tried your suggestions.
>
> At first I tried them in SQL Plus Worksheet. No matter what
> combinations I used, I could not get it to work.
>
> Finally, I tried SQL Plus. After experimenting for a while, I finally
> got the data to export to a text file.
>
> As a follow up question, is it possible to get column headers for this
> data? Everytime I tried this, it failed miserably. This seems like it
> should be easier than what I am making it.


It is easier when you read the sql*plus reference manual.
And obviously
set heading off
will suppress column headers, as that is the very purpose of the
command.
You wouldn't have complained if you would have verified this in the
manual.

--
Sybrand Bakker
Senior Oracle DBA

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:42 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com