Toad World® Forums

Any way to have DBMS output auto-clear on every new execution?

DBMS output window is accumulating results with each execution of a procedure that generates DBMS output. I’m having to manually click the Clear output button with each execution so I don’t get confused as to which messages came from the execution I just ran or previous attempts. This is time-consuming. Is there a way to make DBMS output messages non-persistent, so that they get replaced with each execution so we don’t have to use the Clear button each time?

This is a logged request that I intend to implement in the release following 12.5.

On 03/12/2014 09:04 AM, pwatkins wrote:

Any way to have DBMS output auto-clear on every new execution?

Thread created by pwatkins
DBMS output window is accumulating results with each execution of a procedure that generates DBMS output. I’m having to manually click the Clear output button with each execution so I don’t get confused as to which messages came from the execution I just
ran or previous attempts. This is time-consuming. Is there a way to make DBMS output messages non-persistent, so that they get replaced with each execution so we don’t have to use the Clear button each time?

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - General
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.

Hi,

set serveroutput on size unlimited;
begin
dbms_output.put_line('123 ');
dbms_output.put_line('123 ');
dbms_output.put_line('123 ');
end;
/

Whenever I run mentioned script (as F5) output screen is automatically deleted and there is no output from previous run.
Toad 12.1.0.31

Thank you Damir, I have also settled on that solution. By putting set serveroutput on in glogin.sql and telling Toad to run glogin on script execution, I can remove the DBMS Output window entirely and get everything I need in the script output window.

Glad to help you solved the issue.

Hope you’ll enjoy Toad community and help you could get here in any moment.

I am somewhat new to Toad (coming from a 18 year VBA programming background) and am also interested in clearing the DBMS output window.

I put this line above the word “BEGIN” per your post:

set serveroutput on size unlimited;

and received this error: "ORA-06550 Encountered the symbol “ON” when expecting one of the following: :=.(@%; "

so do I have to have a script run when Toad starts up that will do the autoclear? I’m unsure how to set that up.

Here is my script running as an anonymous block. (It is not part of an existing package)

DECLARE
strTime1 varchar2(50) := ‘06/23/2016 02:30:00 PM’;
strTime2 varchar2(50) := ‘06/23/2016 04:45:00 PM’;
v_date1 date := to_date(strTime1,‘MM/DD/YYYY HH:MI:SS PM’);
v_date2 date := to_date(strTime2,‘MM/DD/YYYY HH:MI:SS PM’);
diff_In_Hours number;
diff_In_minutes number;
diff_In_seconds number;
set serveroutput on size unlimited;

BEGIN
DBMS_OUTPUT.PUT_LINE('TimeConversion-START : '||TO_CHAR(SYSTIMESTAMP,‘mmddyyyy.hh24miss.ff’));

diff_In_Hours := (v_date2 - v_date1) * 24;
diff_In_minutes := diff_In_Hours * 60;
diff_In_seconds := diff_In_minutes * 60;

dbms_output.put_line('START ‘||strTime1||chr(13)||’ — '||'STOP '||strTime2);
dbms_output.put_line('diff_In_Hours : ’ || diff_In_Hours);
dbms_output.put_line('diff_In_minutes: ’ || diff_In_minutes);
dbms_output.put_line('diff_In_seconds: ’ || diff_In_seconds);
DBMS_OUTPUT.PUT_LINE('TimeConversion-STOP : '||TO_CHAR(SYSTIMESTAMP,‘mmddyyyy.hh24miss.ff’));

END; --end main block

I simply want the DBMS Output window to auto clear each time I run this script so I din’t have to clear it manually.

Any pointers are appreciated…thank you.

put the ‘set serveroutput on size unlimited;’ before your DECLARE statement…

set serveroutput on size unlimited;

DECLARE
strTime1 varchar2(50) := ‘06/23/2016 02:30:00 PM’;
strTime2 varchar2(50) := ‘06/23/2016 04:45:00 PM’;
v_date1 date := to_date(strTime1,‘MM/DD/YYYY HH:MI:SS PM’);
v_date2 date := to_date(strTime2,‘MM/DD/YYYY HH:MI:SS PM’);
diff_In_Hours number;
diff_In_minutes number;
diff_In_seconds number;

BEGIN
DBMS_OUTPUT.PUT_LINE('TimeConversion-START : '||TO_CHAR(SYSTIMESTAMP,‘mmddyyyy.hh24miss.ff’));

diff_In_Hours := (v_date2 - v_date1) * 24;
diff_In_minutes := diff_In_Hours * 60;
diff_In_seconds := diff_In_minutes * 60;

dbms_output.put_line('START ‘||strTime1||chr(13)||’ — '||'STOP '||strTime2);
dbms_output.put_line('diff_In_Hours : ’ || diff_In_Hours);
dbms_output.put_line('diff_In_minutes: ’ || diff_In_minutes);
dbms_output.put_line('diff_In_seconds: ’ || diff_In_seconds);
DBMS_OUTPUT.PUT_LINE('TimeConversion-STOP : '||TO_CHAR(SYSTIMESTAMP,‘mmddyyyy.hh24miss.ff’));

END; --end main block

BKuhn,

I put the Set ServerOutput line above the declare per your post here.

set SERVEROUTPUT ON SIZE UNLIMITED;

When running the script with the Serveroutput line (above the "Declare: statement) that line yields an ORA-00922 error (missing or invalid option)

When I remove the set serveroutput line, the script runs fine. (??)