Home > Archive > Other Oracle database topics > November 2005 > How to get output text immediately









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to get output text immediately
Robert Wehofer

2005-11-14, 3:23 am

Hello there!

If I call DBMS_OUT.PUT_LINE before a long process (loop), the text is shown
after the process. Is it possible to get the text on screen immediately
before the process is starting? I need some kind of flush function.

Regards,
Robert


Mark C. Stock

2005-11-14, 7:23 am


"Robert Wehofer" <thalion77@graffiti.net> wrote in message
news:c282b$43785048$
d4badae4$5308@news.chello.at...
> Hello there!
>
> If I call DBMS_OUT.PUT_LINE before a long process (loop), the text is
> shown
> after the process. Is it possible to get the text on screen immediately
> before the process is starting? I need some kind of flush function.
>
> Regards,
> Robert
>
>


not possible with DBMS_OUTPUT, since it buffers output which is accessible
in the current session by the calling program (i'll assume SQL*Plus, you did
not specify) after the calling prorgam regains controls and can issue
DBMS_OUTPUT.GET_LINE calls (which SQL*Plus and other programs do
automatically)

to monitor status of a process while it is running, including debug
messages, the messages have to be made available to another session, via
such mechanisms as:
-- writes to a table (with an autonomous transaction)
-- writes to a file (with the UTL_FILE package)
-- writes to a database pipe (with the DBMS_PIPE package)
-- writes to a queue (with the DBMS_AQ package)

++ mcs


Scott

2005-11-14, 11:23 am

There is also DBMS_APPLICATION_INF
O. From the online documentation
"When an application registers with the database, its name and actions
are recorded in the V$SESSION and V$SQLAREA views."

Michel Cadot

2005-11-14, 11:23 am


"Mark C. Stock" <mcstockX@Xenquery .com> a écrit dans le message de news: xa6dnafKT6um6- XenZ2dnUVZ_sydnZ2d@c
omcast.com...
|
| "Robert Wehofer" <thalion77@graffiti.net> wrote in message
| news:c282b$43785048$
d4badae4$5308@news.chello.at...
| > Hello there!
| >
| > If I call DBMS_OUT.PUT_LINE before a long process (loop), the text is
| > shown
| > after the process. Is it possible to get the text on screen immediately
| > before the process is starting? I need some kind of flush function.
| >
| > Regards,
| > Robert
| >
| >
|
| not possible with DBMS_OUTPUT, since it buffers output which is accessible
| in the current session by the calling program (i'll assume SQL*Plus, you did
| not specify) after the calling prorgam regains controls and can issue
| DBMS_OUTPUT.GET_LINE calls (which SQL*Plus and other programs do
| automatically)
|
| to monitor status of a process while it is running, including debug
| messages, the messages have to be made available to another session, via
| such mechanisms as:
| -- writes to a table (with an autonomous transaction)
| -- writes to a file (with the UTL_FILE package)
| -- writes to a database pipe (with the DBMS_PIPE package)
| -- writes to a queue (with the DBMS_AQ package)
|
| ++ mcs
|

You can also use dbms_application_inf
o.set_client_info and query v$session.

Regards
Michel Cadot


Mark C. Stock

2005-11-14, 11:23 am


"Michel Cadot" <micadot{at}altern{dot}org> wrote in message
news:4378bf23$0$2108
$626a14ce@news.free.fr...
>
> "Mark C. Stock" <mcstockX@Xenquery .com> a écrit dans le message de news:
> xa6dnafKT6um6- XenZ2dnUVZ_sydnZ2d@c
omcast.com...
> |
> | "Robert Wehofer" <thalion77@graffiti.net> wrote in message
> | news:c282b$43785048$
d4badae4$5308@news.chello.at...
> | > Hello there!
> | >
> | > If I call DBMS_OUT.PUT_LINE before a long process (loop), the text is
> | > shown
> | > after the process. Is it possible to get the text on screen
> immediately
> | > before the process is starting? I need some kind of flush function.
> | >
> | > Regards,
> | > Robert
> | >
> | >
> |
> | not possible with DBMS_OUTPUT, since it buffers output which is
> accessible
> | in the current session by the calling program (i'll assume SQL*Plus, you
> did
> | not specify) after the calling prorgam regains controls and can issue
> | DBMS_OUTPUT.GET_LINE calls (which SQL*Plus and other programs do
> | automatically)
> |
> | to monitor status of a process while it is running, including debug
> | messages, the messages have to be made available to another session, via
> | such mechanisms as:
> | -- writes to a table (with an autonomous transaction)
> | -- writes to a file (with the UTL_FILE package)
> | -- writes to a database pipe (with the DBMS_PIPE package)
> | -- writes to a queue (with the DBMS_AQ package)
> |
> | ++ mcs
> |
>
> You can also use dbms_application_inf
o.set_client_info and query
> v$session.
>
> Regards
> Michel Cadot
>
>


which is very helpful for monitoring current status (but not too helpful or
logging message)

also useful for monitoring some long-running operations: V$SESSION_LONGOPS


G Quesnel

2005-11-14, 1:23 pm

If you don't mind sending the output to the database server, you can
use utl_file.putf and utl_file.fflush, in a similar way you would use
dbms_out.put_line.
You can even pretty up the output by manipulating the output strings...
(ex: utl_file.putf(v_filehandle, ' '||v_output_string4|
|'
$(US)'||chr(10)||chr
(10));
the above adds leading spaces and a couple of line feed at the end )

Maxim Demenko

2005-11-14, 1:23 pm

Mark C. Stock schrieb:
> "Michel Cadot" <micadot{at}altern{dot}org> wrote in message
> news:4378bf23$0$2108
$626a14ce@news.free.fr...
>
>
>
> which is very helpful for monitoring current status (but not too helpful or
> logging message)
>
> also useful for monitoring some long-running operations: V$SESSION_LONGOPS
>
>


It depends , how you are logging. And it depends, how OUTPUT is defined.
The most straight forward way to get your message to see immediately (
for example - you have a script running in the sqlplus and output is
your console, maybe redirected to file ) - simply select your message
from dual.

SELECT 'The long running process begins...' FROM DUAL;
BEGIN
--long running process
END;

But it is rather unusual and seldom method with some disadvantages, in
most cases the Michel's suggestion will work much better.

Best regards

Maxim
Robert Wehofer

2005-11-15, 3:23 am


> It depends , how you are logging. And it depends, how OUTPUT is defined.
> The most straight forward way to get your message to see immediately (
> for example - you have a script running in the sqlplus and output is
> your console, maybe redirected to file ) - simply select your message
> from dual.
>
> SELECT 'The long running process begins...' FROM DUAL;
> BEGIN
> --long running process
> END;


That seems not to work in a PL/SQL procedure.

In SQL Plus I'll get the error message

PLS-00428: INTO clause expected in SELECT statement

Robert


Maxim Demenko

2005-11-15, 9:23 am

Robert Wehofer schrieb:
>
>
> That seems not to work in a PL/SQL procedure.
>
> In SQL Plus I'll get the error message
>
> PLS-00428: INTO clause expected in SELECT statement
>
> Robert
>
>


Plsql is supposed to run on the server and in general case detached from
any kind of output device. To get the message from a pl sql unit you
have to use some kind of interprocess communication - the numerous
examples how to do that were given you in all other replies to you post.

Best regards

Maxim
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com