Link to home
Start Free TrialLog in
Avatar of varadish
varadish

asked on

problem with spool off

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
Avatar of cooldba
cooldba

did you check to see that the file system you are trying to write to is not full??
Hi

Check you have turned echo off.

Try after SET ECHO ON

Ashok
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 ?

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.
Avatar of varadish

ASKER

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


Avatar of jtrifts
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.
ASKER CERTIFIED SOLUTION
Avatar of dbrower
dbrower

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
listening...
yes, we tried with ending the statements with ; and it worked.
thanks for that