oracle 如何在 sqlplus 中抑制“PL/SQL 过程成功完成”消息?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/250509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 01:36:01  来源:igfitidea点击:

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

oracleplsqlsqlplus

提问by JJMoho

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?

有没有一种方法可以在 sqlplus 中将 SERVEROUTPUT 设置为 ON 但以某种方式抑制在 plsql 过程完成后自动生成的消息“PL/SQL 过程成功完成”?

回答by Tony Andrews

Use the command:

使用命令:

SET FEEDBACK OFF

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

在运行程序之前。之后你可以再次打开它:

SET FEEDBACK ON

回答by MikeA

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:

这在 sqlplus 中对我来说效果很好,但我确实注意到“设置反馈关闭”会抑制 Sql Developer(至少版本 17.2.0.188)中的错误。如果您使用 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.