Re: Print within PL/SQL?

From: David Hiltz <dhiltz_at_whsun1.whoi.edu>
Date: 8 Jan 1995 00:38:15 GMT
Message-ID: <3enc5n$eft_at_pearl.whoi.edu>


Dewey Blaylock (tactics_at_crl.com) wrote:
: 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

  This is the number one reason I moved to OraPerl for program like this -   the screen I/O in PL/SQL sucks. PL/SQL was meant to be used with Forms   (which provides the I/O), but not all PL/SQL code requires Forms.



  David Hiltz
  dhiltz_at_whsun1.wh.whoi.edu
  Network System Administrator
  Northeast Fisheries Science Center
  ######&_at_&###### Received on Sun Jan 08 1995 - 01:38:15 CET

Original text of this message