Solved

Oracle Spool question

Posted on 2004-10-01
10
2,171 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
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
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.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PL/SQL Display based on value 4 39
Oracle encryption 12 48
pivot rows to columns 1 34
Oracle DB Slows After Datapump Until Next Reboot 27 91
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
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…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

809 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