Oracle DBMS_OUTPUT屏幕打印信息

2022/1/8 2:06:15

本文主要是介绍Oracle DBMS_OUTPUT屏幕打印信息,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

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).

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

>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)



这篇关于Oracle DBMS_OUTPUT屏幕打印信息的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程