TERMOUT OFF and AUTOTRACE in SQLPLUS for suppress the output

TERMOUT OFF and AUTOTRACE in SQLPLUS for suppress the output of SQL

We need to suppress the query output in SQLPLUS, we tried different option to suppress the query output.
–SET TERMOUT OFF
–SET AUTOTRACE TRACEONLY

SET TERMOUT OFF
Following example show the TERMOUT use:
Connect with SQLPLUS and use of TERMOUT only work with the query that is stored in file and try to run that from the file with @.
It will now suppress the output of sql query which execute directly on SQLPLUS.

SQL> Select count(*) from emp;

COUNT(*)
----------
38335960

SQL> @C:\d\1.sql;

COUNT(*)
----------
38335960

SQL> set termout off
SQL> @C:\d\1.sql;
SQL>
SQL> Select count(*) from emp;

COUNT(*)
----------
38335960

SET AUTOTRACE TRACEONLY
You can use the set autotrace traceonly will suppress the output but it will generate execution plan for it.

SQL> set autotrace traceonly
SQL> Select count(*) from emp;

Execution Plan
----------------------------------------------------------
Plan hash value: 2083865914

-------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Cost (%CPU)| Time     |
-------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     1 |   164K  (1)| 00:00:07 |
|   1 |  SORT AGGREGATE    |      |     1 |            |          |
|   2 |   TABLE ACCESS FULL| EMP  |    38M|   164K  (1)| 00:00:07 |
-------------------------------------------------------------------


Statistics
----------------------------------------------------------
          0  recursive calls
          0  db block gets
     605648  consistent gets
     605641  physical reads
          0  redo size
        553  bytes sent via SQL*Net to client
        623  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.