Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Oracle Spool question

Posted on 2004-10-01
10
Medium Priority
?
2,176 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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 500 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

Industry Leaders: 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!

Question has a verified solution.

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

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
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…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to recover a database from a user managed backup

604 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