Re: basic pl/sql question

From: Michael <michael1_at_xs4all.nl>
Date: Wed, 01 Jul 1998 18:52:53 +0200
Message-ID: <359A6964.E8423D5D_at_xs4all.nl>


Rohrbacher, Boris schreef:

> Hi Dennis
>
> > I created a script containing a cursor. In the begin section, I am
> > looping through each of the records in this cursor. What I want to
> > do (for starters) is to print out each record that it finds. What
> > command can I use to print out a single line of output? Am I limited
> > to the "select" statement to producer output to the screen? There
> > must be something else, right?
> >
>
> Where do you produce output ?
>
> If in SQLPLUS you can :
>
> set output on
>
> -- an then
> declare
> cursor c is select ...... from table... ;
> x c%ROWTYPE;
> begin
>
> open c;
> loop
> fetch c into x ;
> exit when c%NOTFOUND;
> dbms_output.put_line( x.col1 || x.col2 .... ) ;
> end loop;
> end ;

Correction

The right syntax to display output to the screen is: set serveroutput on

Since the default buffersize is only 2000 bytes you can increase the size by typing

set serveroutput on size 1000000 (1 million bytes is the maximum)

You can also write output to a file

use the command:
spool filename.ext

You can type this at the prompt before startin your PL/SQL script or ad it to the script.
To stop spooling type :
spool off

Your file is now ready for printing or editing

Michael Received on Wed Jul 01 1998 - 18:52:53 CEST

Original text of this message