Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: sqlplus : How to turn off output to terminal ?

Re: sqlplus : How to turn off output to terminal ?

From: Jerry Apfelbaum <japfelba_at_ican.ca>
Date: 1997/03/09
Message-ID: <33236B25.7476@ican.ca>#1/1

> On 28 Feb 1997 12:59:56 -0600, aak2_at_Ra.MsState.Edu (Atif Ahmad Khan)
> wrote:
> >How do I turn off output to terminal sqlplus from a select statement when I
> >am spooling the result to a text file ?
> >I have tried echo off, feedback off etc. but nothing seems to work.
> >The problem is not easy to handle when the result is huge and I am
> >over a modem connection.
>
> Have you tried " set flush off" ?
>
> rgrds Kari

The option to use is: set termout off

There are some restrictions, though. 'set termout off' will only work if you are running an external SQL script (eg, start sqlscript.sql). It does not work for an interactive query from the keyboard.

Furthermore, if you are using UNIX and the SQL is in an in-line redirect (aka, a here document), then 'set termout off' will not work either because SQL*Plus still thinks it is interactive input. The following is a simple example of such a case:

    sqlplus -s username/password << endOfSQL     set termout off
    select * from emp;
endOfSQL

In the above UNIX script, the 'set termout off' will NOT stop output to standard output. This is because UNIX passes the 'SQL script' to SQL*Plus as if it were interactively input through the keyboard. One way I have used to get around this is to pipe the output of the SQL*Plus, such as:

    sqlplus -s username/password << endOfSQL | grep -E "^ORA-|^ERROR"     select * from emp;
endOfSQL

In the above example, your terminal would only show you Oracle error lines. Other variants are obviously possible according to your needs.

Hope this helps.


Jerry Apfelbaum           email: japfelba_at_ican.ca
Eastern Sun Group Inc.    phone:     416.769.8738 
Toronto, Canada             fax:     416.769.7428
Received on Sun Mar 09 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US