Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

problem with spool off

Posted on 2001-06-06
9
Medium Priority
?
770 Views
Last Modified: 2012-08-13
Hi,
I want to write the output of the sql statement into a text file. for that i am doing some thing like this,

spool filename
set head off
Select Statement
spool off

then, it is creating a file but not writing anything.
if i comment the line 'spool off', it is working fine.
can anyone have a clue.
thanks in advance.
varadish
0
Comment
Question by:varadish
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 

Expert Comment

by:cooldba
ID: 6161513
did you check to see that the file system you are trying to write to is not full??
0
 
LVL 1

Expert Comment

by:ashokskumar
ID: 6161578
Hi

Check you have turned echo off.

Try after SET ECHO ON

Ashok
0
 

Expert Comment

by:mohit_bhatnagar
ID: 6162041
spool does not have any impact of echo on/off.

ur steps are right.

can u be more specific means can u write ur exact code ?

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Expert Comment

by:Sampathi
ID: 6162425
The only way it can create a file but write no records to it (OKB) is when you forgot to say Spool off after the select statement.

If you say spool off it will always flush what it has to the file, Till you specify spool off it will not flush the dat to the file so the file will read 0KB.
0
 

Author Comment

by:varadish
ID: 6163925
dear sampathi,
what u said is absolutely right.
but the problem is, here it is happening just the opposite way.

mohit,
the exact code is simply just like this

spool customer.txt
set head off
Select * from customer_master
spool off

help please.....
varadish


0
 
LVL 4

Expert Comment

by:jtrifts
ID: 6164699
May I sugget you check your start-in directory for sqlplus?  It could be that the file is being written to another location, whereas you might have created the first empty copy by stating a spool off incorrectly.

Otherwise:

spool <filename.ext>
anything you type from this point should appear in the spool file.
If you put the echo on, each query will re-state itself onscreen to show you what it is running.
spool off
at this point the spool buffer is written to the file.
0
 
LVL 1

Accepted Solution

by:
dbrower earned 150 total points
ID: 6164727
Your problem may be caused by not properly ending your SQL statement (missing the ; ) in your script.

If this is a script file try:

set head off
spool customer.txt
select * from customer_master
/
spool off

everything else looks OK

0
 
LVL 2

Expert Comment

by:sefa
ID: 6164741
listening...
0
 

Author Comment

by:varadish
ID: 6164872
yes, we tried with ending the statements with ; and it worked.
thanks for that
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to take different types of Oracle backups using RMAN.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question