Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I Suppress "PL/SQL procedure successfully completed" message in sqlplus?

Is there a way that you can have SERVEROUTPUT set to ON in sqlplus but somehow repress the message "PL/SQL procedure successfully completed" that is automatically generated upon completed execution of a plsql procedure?

like image 334
JJMoho Avatar asked Oct 30 '08 15:10

JJMoho


People also ask

How do you stop a command in Sqlplus?

1) If it is a windows SQL*PLus, click on File/Cancel. 2) Press Cntrl + C which will also stop the execution.

How do you terminate a procedure in PL SQL?

When the EXIT statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop.

Which package enables the output messages from Plsql blocks?

The DBMS_OUTPUT is a built-in package that enables you to display output, debugging information, and send messages from PL/SQL blocks, subprograms, packages, and triggers.

How do you stop a block in PL SQL?

A PL/SQL block has an executable section. An executable section starts with the keyword BEGIN and ends with the keyword END . The executable section must have a least one executable statement, even if it is the NULL statement which does nothing.


2 Answers

Use the command:

SET FEEDBACK OFF 

before running the procedure. And afterwards you can turn it back on again:

SET FEEDBACK ON 
like image 94
Tony Andrews Avatar answered Oct 01 '22 12:10

Tony Andrews


This has worked well for me in sqlplus, but I did just notice that "set feedback off" suppresses errors in Sql Developer (at least version 17.2.0.188). Just something to be aware of if you use Sql Developer:

create or replace procedure test_throw_an_error as buzz number; begin dbms_output.put_line('In test_throw_an_error. Now, to infinity!'); buzz:=1/0; end; / set serveroutput on set feedback off exec test_throw_an_error; exec dbms_output.put_line('Done, with feedback off'); set feedback on exec test_throw_an_error; exec dbms_output.put_line('Done, with feedback on'); 

Result:

Procedure TEST_THROW_AN_ERROR compiled  In test_throw_an_error. Now, to infinity!  Done, with feedback off  In test_throw_an_error. Now, to infinity!   Error starting at line : 11 in command - BEGIN test_throw_an_error; END; Error report - ORA-01476: divisor is equal to zero ORA-06512: at "ECTRUNK.TEST_THROW_AN_ERROR", line 1 ORA-06512: at line 1 01476. 00000 -  "divisor is equal to zero" *Cause:     *Action: Done, with feedback on  PL/SQL procedure successfully completed. 
like image 20
MikeA Avatar answered Oct 01 '22 13:10

MikeA