How to Prevent displaying Query result on the screen in SQL* Plus

Click here for a 1 min. Video of this topic )

If you want to capture query output to a log file, but do not want to display it on the screen, use SET TERMOUT OFF before spooling and SET TERMOUT ON afterwards. 

This works only when the query is run as a script using @, @@ or START command. This setting does not work for SQL query that is executed interactively in SQL*Plus prompt.

Example: 

Put the following lines of command in a script (example: termout.sql) and execute the script with '@' symbol.

     SET TERMOUT OFF
   SPOOL silent_output.txt
    SELECT * FROM employees;
    SPOOL OFF
    SET TERMOUT ON


SQL> @termout.sql

#####################################################################

 ** Email to info@shreyantech.com to get the Tip of the Day in your mailbox

No comments:

Post a Comment