Home » SQL & PL/SQL » SQL & PL/SQL » need to remove sql query
need to remove sql query [message #319652] Mon, 12 May 2008 08:38 Go to next message
shoaib123
Messages: 118
Registered: December 2007
Location: Chicago
Senior Member

SQL> set feedback off;
SQL> spool C:/test.txt
SQL> select * from temp;
SQL> spool off

In the file test.txt. the output looks like this..

SQL> select * from temp;

qasim      1            123                                                     
ahmed      2            123                                                     
JANGW   143                                                     
        143                                                     

SQL> spool off


is there any option which can remove the sql query and spool off display from the spooled file.

Thanks in advance and appreciate your valuable time..
Re: need to remove sql query [message #319654 is a reply to message #319652] Mon, 12 May 2008 08:43 Go to previous messageGo to next message
Michel Cadot
Messages: 64120
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If the statements are in a script, just use "set echo off".
If the statements are interactively entered, there is no way.

Regards
Michel
Re: need to remove sql query [message #319683 is a reply to message #319652] Mon, 12 May 2008 10:56 Go to previous message
Kevin Meade
Messages: 2101
Registered: December 1999
Location: Connecticut USA
Senior Member
If you are looking for more than just a quick answer, then I suggest you read the SQLPLUS user's guide and look at all the SET commands. Remember, there is a difference between SQL and SQLPLUS. SQL is the select,insert,update,delete commands you use to change data. SQLPLUS is an Oracle tool in which you can execute SQL.

SQLPLUS commands are not SQL, they are the environment commands you can use to change the environment of SQLPLUS and thus how it behaves. So, you have thinkgs like SET ..., COLUMN ..., and other stuff. You might want to consider this set of SET commands as a start for your data dump:

SET ECHO OFF
SET VERIFY OFF
SET TRIMSPOOL ON
SET TRIMOUT ON
SET LINESIZE 9999
SET PAGESIZE 0
SET FEEDBACK OFF
SET TIMING OFF
SET TIME OFF

These SQLPLUS commands will I believe make sure you get the clean spool you are looking for.

As Michel pointed out however, you must run you SQL commands from a file if you want this to work. For example:

@runthissql.sql


If you simply past SQL into SQLPLUS, it will always show up in your spool file.

Lastly, if you do not know what all the SET commands above do, then you shouldn't use them right? You dont' just take blanket advice without doing your own research. Which gets us back to... you should be reading the SQLPLUS manual to find out.

http://www.oracle.com/technology/docs/tech/sql_plus/index.html


Good luck, Kevin

[Updated on: Mon, 12 May 2008 10:57]

Report message to a moderator

Previous Topic: Grouping by Saturday and Sunday
Next Topic: query to find bonus qty and ytd quantity form a given table (merged)
Goto Forum:
  


Current Time: Tue Dec 06 14:27:29 CST 2016

Total time taken to generate the page: 0.13011 seconds