Solved

Oracle Spool question

Posted on 2004-10-01
10
2,174 Views
Last Modified: 2010-05-18
Hi all Experts,

I want to spool the result to a file whcih I was able to do but I donot want the select string and
X rows selected, Spool off to be showed up on the file..


EX :
Select * from X; ( SHOULD NOT SHOW)

A   B (ONLY THIS (DATA) HAS TO SHOW ON THE FILE)

1 row selected (Should not show)
Spool off (Should not Show)

Any help is appriciated.

Thanks in advance

Thanks
Madhavi





0
Comment
Question by:Regulapati
[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
  • 5
  • 3
  • 2
10 Comments
 
LVL 1

Expert Comment

by:flevyhara
ID: 12203475
Try:

SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0
set linesize 1024
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
0
 
LVL 1

Expert Comment

by:flevyhara
ID: 12203550
Actually, some of the lines remain.

Try, (from command line, not from SQLPLUS):

sqlplus -s username/password @test

and on the test.sql file:
SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
select * from dual;
exit;
0
 

Author Comment

by:Regulapati
ID: 12203574
HI flevyhara,


I tried this but sill getting my select string in the file..
Do I need to do anything else
This is what has been showd on the file
SELECT * FORM TABLE; ( DONOT WANT THIS)
ROWS ( WITH OUT HEADINGS)
Spool OFF;

Thanks
Madhavi
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:SDutta
ID: 12203589
I use these set commands, some of them may be same as in the previous comment but I dont get the script lines out. The COLSEP setting will remove the default column separator of one space.

set PAGESIZE 0
set COLSEP ''
set TERMOUT off
set WRAP on
set VERIFY off
set HEADING off
set SHOWMODE off
set feedback off
spool c:\test.log
SELECT * from X;
spool off
0
 

Author Comment

by:Regulapati
ID: 12203591
HI flevyhara,
 
I will try the second one on Monday and will let you know

Thanks again

Madhavi
0
 

Author Comment

by:Regulapati
ID: 12230579
Hi Flevyhara,

I tried your second option from command line it is running with out any errors but I could not see
where it is creating the output file, can I give any parameters to specify where to create the
out put file

Thanks
Madhavi
0
 

Author Comment

by:Regulapati
ID: 12230629
Hi SDutta,

I tried your lines of code but it is still spooling the query also.

EX:

SQL> select * from Dual;
X                                                                                                  
SQL> spool off;

This what it showd up in the spool file.
I just want to see the "X" in the file

Thanks
Madhavi




0
 
LVL 10

Expert Comment

by:SDutta
ID: 12230780
Also try setting
SET ECHO OFF
0
 
LVL 10

Accepted Solution

by:
SDutta earned 125 total points
ID: 12230820
If that doesnt work, put the following set commands along with the select sql into a file say test.sql
set PAGESIZE 0
set COLSEP ''
set TERMOUT off
set WRAP on
set VERIFY off
set HEADING off
set SHOWMODE off
set feedback off
spool c:\test.log
SELECT * from X;
spool off
exit

Then from OS

sqlplus /nolog
SQL> connect user/pwd@dbname
Enter password:
Connected.
SQL>@test.sql
SQL>exit

OR

sqlplus user/pwd@dbname @test.sql
0
 

Author Comment

by:Regulapati
ID: 12230940
Hi SDutta,

Thanks for your help. It worked


Thanks
Madhavi.R
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

717 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