Re: Print within PL/SQL?

From: Dewey Blaylock <tactics_at_crl.com>
Date: 6 Jan 1995 16:32:30 -0800
Message-ID: <3ekneu$ok7_at_crl2.crl.com>


bendermac_at_interramp.com wrote:

: Hi,
: I have a PL/SQL script file which I run within SQLPLUS using "_at_script_filename"
: command. I would like to print variable values on the screen or to a text
: file. For example:

: script file:
 

: declare
: fld1 table_a.fld1%type;
: ....
 

: cursor c1 is
: select fld1, ... from table_a;
 

: begin
: open c1;
: loop
: fetch c1 into fld1, ....;
: exit when c1%notfound;
 

: <here I like to print "fld1" on the screen or to a text file>
 

: ....
: end;
: /
 

: Any ideas, suggestions?
 

: Thanks
: Asim
: BMC
Yes, try using

   dbms_output.put_line(variable);

when you actually run the script in sqlplus you may need to SET SERVEROUTPUT ON
This will enable screen output. Do this before you run your script. If you receive a buffer overflow then you can set the buffer size by issuing
Execute dbms_output.enable(buffer_size); where buffer_size is a number

that is your desired size  The                             
  --  minimum is 2000 and the maximum is 1,000,000.                
2000 is the default

GT Received on Sat Jan 07 1995 - 01:32:30 CET

Original text of this message