可参考官方的说明,就是给sqlplus使用进行调试的,如下:
The package is typically used for debugging, or for displaying messages and reports to SQLDBA or SQLPlus (such as are produced by applying the SQL command
DESCRIBE
to procedures).
一般情况下,此设置默认是关闭的,需要通过命令进行打开:
>sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on 星期三 1月 5 23:48:46 2022 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. 连接到: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0 SQL> set serveroutput on;
但上述方式只是针对当前会话有效,如果退出后再登录就会失效,需要重新设置,如果需要永久打开,可使用下面的方法,在$ORACLE_HOME/sqlplus/admin/
目录下的glogin.sql
文件中增加set serveroutput on
这句代码,如下:
-- -- Copyright (c) 1988, 2005, Oracle. All Rights Reserved. -- -- NAME -- glogin.sql -- -- DESCRIPTION -- SQL*Plus global login "site profile" file -- -- Add any SQL*Plus commands here that are to be executed when a -- user starts SQL*Plus, or uses the SQL*Plus CONNECT command. -- -- USAGE -- This script is automatically run -- set serveroutput on
其他相关信息可参考官方文档说明:DBMS_OUTPUT (oracle.com)