Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to force a flush of dbms_output.put_line

8,556 views
Skip to first unread message

Xuewei Zhou

unread,
May 29, 1997, 3:00:00 AM5/29/97
to

I notice dbms_output.put_line does not print out the lines until my procedure
is finished. I put 100 put_line in my procedure, it doesn't print one by one,
it prints all of them at the end. Is there a way to force it print right after
dbms_output.put_line is called?

Thanks,

zhou

Frank McGeough

unread,
May 30, 1997, 3:00:00 AM5/30/97
to

Since dbms_output.put_line outputs only after a block completes
I would suggest that you make a procedure for debugging that
take a VARCHAR as a parameter containing your debug string.
Then call that from within your PL/SQL block that you're
attempting to debug. I believe that might work. Good luck.

Xuewei Zhou <zh...@Glue.umd.edu> wrote in article
<5mk7d6$8...@y.glue.umd.edu>...

flange

unread,
May 31, 1997, 3:00:00 AM5/31/97
to

Hi,
Instead of writting line to dbms output send then by dbms_pipe.

From an other session run a small pl-sql block whihc read from dbms_pipe
and display the line by dbms_output. execute this program all times.


REM TO DEBUG.

Send to dbms_pipe.


Send to dbms_pipe

REM displayer


begin
read_pipe( time to wait 100000)
display
end ;

to run it all time.


while cat displayer.sql
do
:
done ¦ sqlplus user/password@db

Francois.

cat

Pierre

unread,
Jun 1, 1997, 3:00:00 AM6/1/97
to

This is not normal behavior.
Send me your procedure, I'll take a look at it.

CIAO Pierre


Wayne Linton

unread,
Jun 1, 1997, 3:00:00 AM6/1/97
to

Xuewei Zhou wrote:
>
> I notice dbms_output.put_line does not print out the lines until my procedure
> is finished. I put 100 put_line in my procedure, it doesn't print one by one,
> it prints all of them at the end. Is there a way to force it print right after
> dbms_output.put_line is called?
>
> Thanks,
>
> zhou

Try writing to a pipe, and have another task running that reads the pipe
and displays the message.

Wayne Linton
Shell Canada Ltd.

Jurij Modic

unread,
Jun 2, 1997, 3:00:00 AM6/2/97
to

On 1 Jun 1997 15:39:34 GMT, mave...@videotron.ca (Pierre) wrote:

>This is not normal behavior.
>Send me your procedure, I'll take a look at it.

Don't bother looking at it, because the described behavior of
DBMS_OUTPUT is (unfortunately) perfectly normal. Output can not be
displayed until PL/SQL program completes (the whole program, not just
sub-block!) and returns controll to its caller (SQL*Plus for example).
There is no way to flush DBMS_OUTPUT buffer from inside of PL/SQL
program!

>
>CIAO Pierre
>

============================================================
Jurij Modic Republic of Slovenia
tel: +386 61 178 55 14 Ministry of Finance
fax: +386 61 21 45 84 Zupanciceva 3
e-mail: jurij...@mf.sigov.mail.si Ljubljana 1000
============================================================

Sergey V. Fedorishin

unread,
Jun 16, 1997, 3:00:00 AM6/16/97
to

Wayne Linton (lin...@cadvision.com) wrote:

It seems there is no way to flush dbms_output. It built this way. But,
it is not clear yet how to 'display the message': dbms_output.put_line???!
I was trying to use low level file I/O but couldn't open file via fopen:
it fires invalid_path on every combination of basename and filename I've
tryed. Any suggestion would be helpful.

TIA -Sergey.

: Wayne Linton
: Shell Canada Ltd.


Vijay Darekar

unread,
Jun 16, 1997, 3:00:00 AM6/16/97
to


dbms_output.put_line won't print until the procedure is over.
About the fopen problem. Are you using utl_file package provided oracle
then check the parameter in the setup.
I forgot the exact parameter name but you can find out from the
parameter table by using

select name, value
from v$parameter
where name like '%file%'

You need to set that parameter as the path name in the init_ora. The
utl_file utility will read/write only from/in that directory.

Vijay Darekar


Your Name

unread,
Jun 16, 1997, 3:00:00 AM6/16/97
to

Hi,

The program to debug send its information throught a dbms_pipe, each line.

instead of dbms_output.put_line ( .....)
^
Same
V
debug_to_pipe ( to_char ( ...... ) ) ;

or define more debug_to_pipe

procedure debug_to_pipe(reason varchar2) is
s integer;
begin
dbms_pipe.pack_message(reason);
s := dbms_pipe.send_message('DEBUG');
if s <> 0 then
raise_application_error(-20000, 'Error:' || to_char(s) || '
sending on pipe');
end if;
end debug_to_pipe ;


The debug_display program is a small program, it read the pipe dbms_pipe
and display the information to the screen and that all.

procedure pipe_to_screen is
s integer;
msg varchar2(200);
begin
s := dbms_pipe.receive_message('DEBUG');
dbms_pipe.unpack_message(msg,99999999);
dbms_output.put_line ( msg ) ;
if msg = 'QUIT'
then
s := 1 / 0 ;
end if ;
end pipe_to_screen;

#!/bin/sh
( echo "whenever sql_error exit 0\nset serveroutput on\nspool on"
while true
do
echo "begin pipe_to_screen ; end ;\n/"
done ¦ sqlplus -s /

Regards Francois.

Sergey V. Fedorishin <sfed...@grads.fiu.edu> wrote in article
<5o25p1$2...@isis.fiu.edu>...

Sergey V. Fedorishin

unread,
Jun 18, 1997, 3:00:00 AM6/18/97
to

Vijay Darekar (vij...@worldnet.att.net) wrote:
[snip]

: dbms_output.put_line won't print until the procedure is over.


: About the fopen problem. Are you using utl_file package provided oracle
: then check the parameter in the setup.
: I forgot the exact parameter name but you can find out from the
: parameter table by using

: select name, value
: from v$parameter
: where name like '%file%'

: You need to set that parameter as the path name in the init_ora. The
: utl_file utility will read/write only from/in that directory.

Thank you, I already found that it was not set properly in init_ora (or
init.ora) and it takes a time to reset and restart. But what is
interesting about fopen, the ID and LOCATION have same position #, and
record and ID have different pos #. Any comments? Or it is just our
installation...

ARGUMENT_NAME POSITION SEQUENCE DATA_LEVEL DATA_TYPE
------------------------------ ---------- ---------- ---------- --------------
0 1 0 PL/SQL RECORD
ID 1 2 1 BINARY_INTEGER
LOCATION 1 3 0 VARCHAR2
FILENAME 2 4 0 VARCHAR2
OPEN_MODE 3 5 0 VARCHAR2

SQL>

: Vijay Darekar


--
-Sergey.

0 new messages