Re: SQL*Plus:how to redirect result to a file?

From: Hugh Patrick <hugh.patrick_at_virgin.net>
Date: Thu, 23 Nov 2000 23:22:16 +0000
Message-ID: <3A1DA6A8.A305832_at_virgin.net>


Steve wrote:

> Hi everyone! Can anyone tell me how to redirect a query result to a file
> so that I can browse it later on? Another question: how to let the query
> result show up page by page instead of scrolling down to the bottom?
> Sometimes the query result is really long. Thanks!
>
> Steve

To redirect the output to a file, use 'spool'. For example, under Unix

  • begin code --- spool /tmp/oracle.txt select * from cat; spool off
  • end code ---

Note: if you do not specify a file extension, sqlplus will automatically append a '.lst' to the filename.

To show a page at a time, type
set pause on

Note: when pause is on, it pauses before displaying the first page of rows. I find it helpful to add a second 'set pause "more..."' so I know when data is waiting to be displayed.

Regards
Hugh Received on Fri Nov 24 2000 - 00:22:16 CET

Original text of this message