如何从通过数据库链接执行的存储过程中进行假脱机?
我正在使用 UNIX 脚本来运行 sql 代码,该代码通过数据库链接启动存储过程。我可以成功完成该过程,但是没有任何 DBMS 输出被假脱机到指定的 SPOOL 文件。
UNIX 中的 SQL:
set feedback off;
set linesize 500;
set serveroutput on size 1000000;
set serveroutput on format wrapped;
spool $SQLspool;
whenever oserror exit;
whenever sqlerror exit sql.sqlcode;
DECLARE
retcode integer :=0;
BEGIN
owner.procedure@db;
dbms_output.put_line('');
dbms_output.put_line('return code: ' || retcode);
dbms_output.put_line('');
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;
/
EXIT;
SPOOLFILE 内容:
return code: 0
我在存储过程中列出了一堆 DMBS 输出,但没有任何内容写入假脱机文件。
如何让它输出到假脱机文件?
我尝试使用 IN OUT 变量,但由于该过程包含 COMMIT,因此它会因参数而出错,因为它正在通过 DB Link...
I am using a UNIX script to run sql code that kicks off a stored procedure via database link. I can get the procedure to complete successfully, however none of the DBMS outputs are spooled to the SPOOL file indicated.
SQL within UNIX:
set feedback off;
set linesize 500;
set serveroutput on size 1000000;
set serveroutput on format wrapped;
spool $SQLspool;
whenever oserror exit;
whenever sqlerror exit sql.sqlcode;
DECLARE
retcode integer :=0;
BEGIN
owner.procedure@db;
dbms_output.put_line('');
dbms_output.put_line('return code: ' || retcode);
dbms_output.put_line('');
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;
/
EXIT;
SPOOLFILE CONTENTS:
return code: 0
I list a bunch of DMBS outputs within the stored procedure but nothing is written to the spool file.
How can I get it to output to the spool file?
I tried to have IN OUT variables, but because the procedure contains COMMITs it errors out with the parameters since it is going through the DB Link...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PUT 和 PUT_LINE 的输出被缓冲。来自 Oracle 文档
:
因此,如果您希望流式传输响应,您将需要编写一个不缓冲输出的小程序。
The output for PUT and PUT_LINE is buffered. From the Oracle docs
:
So, if you are looking to stream responses you are going to need to write a small program which does not buffer the output.