Solved

Oracle Spool question

Posted on 2004-10-01
10
2,159 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
  • 5
  • 3
  • 2
10 Comments
 
LVL 1

Expert Comment

by:flevyhara
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 10

Expert Comment

by:SDutta
Comment Utility
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
Comment Utility
HI flevyhara,
 
I will try the second one on Monday and will let you know

Thanks again

Madhavi
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:Regulapati
Comment Utility
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
Comment Utility
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
Comment Utility
Also try setting
SET ECHO OFF
0
 
LVL 10

Accepted Solution

by:
SDutta earned 125 total points
Comment Utility
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
Comment Utility
Hi SDutta,

Thanks for your help. It worked


Thanks
Madhavi.R
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now