Oracle PL/SQL - 即时输出/控制台打印提示

Oracle PL/SQL - tips for immediate output / console printing(Oracle PL/SQL - 即时输出/控制台打印提示)
本文介绍了Oracle PL/SQL - 即时输出/控制台打印提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多可能需要几分钟才能运行的 pl/sql 过程.在开发它们时,我添加了一些打印语句来帮助调试并提供一些反馈和进度指示器.最初,我在小型测试集上运行这些,输出几乎是即时的.现在我正在测试需要几分钟才能运行的更大的测试集,我发现打印到控制台不再合适,因为在过程结束之前不会打印任何内容.我习惯于在不缓冲输出并立即打印的环境中工作,并且为简单的调试和诊断添加简单的打印语句是很常见的.

I have a number of pl/sql procedures that can take several minutes to run. While developing them, I've added a few print statements to help debug and also provide some feedback and progress indicators. Initially, I ran these on small test sets and output was almost instantaneous. Now that I'm testing with larger test sets that take several minutes to run, I find that printing to the console is no longer suitable, because nothing gets printed until the procedure ends. I'm used to working in environments that do not buffer their output and print it immediately and adding simple print-statements for simple debugging and diagnostic is common.

在 pl/sql 中是否可以立即打印输出(不缓冲)?如果不是,人们推荐哪些替代方案来获得类似的结果?

Is it possible in pl/sql to print output immediately (not buffered)? If not, what alternatives do people recommend to get a similar result?

推荐答案

您可以拥有一个使用自治事务将消息写入表的过程,例如:

You can have a procedure that writes messages to a table using an autonomous transaction something like:

procedure log (p_message)
is
    pragma autonomous_transaction;
begin
    insert into message_log (user, datetime, message)
    values (user, sysdate, p_message);
    commit;
end;

然后从另一个 Oracle 会话监视该表.

Then monitor the table from another Oracle session.

这篇关于Oracle PL/SQL - 即时输出/控制台打印提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

SQL to Generate Periodic Snapshots from Transactions Table(用于从事务表生成定期快照的SQL)
MyBatis support for multiple databases(MyBatis支持多个数据库)
Oracle 12c SQL: Missing column Headers in result(Oracle 12c SQL:结果中缺少列标题)
SQL query to find the number of customers who shopped for 3 consecutive days in month of January 2020(查询2020年1月连续购物3天的客户数量)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))
Select the latest record for an Id per day - Oracle pl sql(选择每天ID的最新记录-Oracle pl SQL)