Oracle DBMS_OUTPUT屏幕打印信息

本文遵循BY-SA版权协议,转载请附上原文出处链接。


本文作者: 黑伴白

本文链接: http://heibanbai.com.cn/posts/c0c05629/

Oracle DBMS_OUTPUT屏幕打印信息

可参考官方的说明,就是给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).

一般情况下,此设置默认是关闭的,需要通过命令进行打开:

1
2
3
4
5
6
7
8
9
10
11
12
13
>sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on 星期三 15 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这句代码,如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
--
-- 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)


蚂蚁再小也是肉🥩!


Oracle DBMS_OUTPUT屏幕打印信息
http://heibanbai.com.cn/posts/c0c05629/
作者
黑伴白
发布于
2022年1月7日
许可协议

“您的支持,我的动力!觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付