Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql plus output 3

Status
Not open for further replies.

maswien

Technical User
Sep 24, 2003
1,286
0
0
CA

why following code always output the SQL to file EDT.txt and print the resultset two times?

Code:
set linesize 200
set trimspool on
set pagesize 60
spool c:\oracle_report\EDT.txt
 
  Select...

spool off

How to fix this problem? Thanks
 
Hi,
Do you mean the output file has 2 sets of the returned data from the Select statement ?
(also, try after setting feedback off)

Can you post a sample?
[profile]

 

I tried that, but "set feedback off" only supress " # rows selected". The results are still displayed two times.
 
Try

set echo off

This controls wheather the 'start' command lists each command in a command file as the command is executed. 'On' lists the commands and 'off' supresses the listing.
 

Set echo off, SQL Plus still output the same.
 

Musafa, you are right! that makes the results display duplicate, but I still struggle to supress the SQL.
 
Maswien,

Those, above, who suggest "set echo off" assert the method by which SQL*Plus suppresses scripted commands. Could you please post an exact image of your script plus the results that display on the screen, obscuring, of course any private or proprietary content?

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 

script:

Code:
set linesize 200
set trimspool on
set pagesize 59
set echo off
spool c:\temp\EPT.txt
select * from application
/
spool off


following content in EPT.txt

Code:
SQL> select * from application
  2  /

APPL            dept                                     div                  name                
--------------- ---------------------------------------- -------------------- -------------------------
sdcd            fdgdfgdgdfgfgdfgdfgffff                  ytt                  fdsa         
sdsdswwdsd      fghfggggfff                              rty                   hjj                                                
ssddsd          sdddfffffffffdddddd                      fff                  gggg                    
...

93 rows selected.

SQL> spool off
 
Maswien,

Also to confirm...are you 1) Pasting the code onto the screen at a SQL> prompt, or 2) Invoking the script with a "@<script_name"?. I'm asking because I do not see on your copy and paste any evidence of a "@<script_name>" invocation.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 
I copied and pasted there, didn't use @scriptfile, that makes difference?
 

Yes Mufasa, it does make difference for me, when I run it using @scriptfile, everything looks fine, so I should do that way, thanks for the help!
 
Yes...that is why I bolded ...suppresses scripted commands..., because "set echo off" has an effect only when you run it from a script. I should have said, instead, "...the method by which SQL*Plus suppresses the output of commands when invoked from '@<script_name>'...". [cheers]

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top