在一个bash脚本文件打印DBMS_OUTPUT.PUT_LINE [英] Print DBMS_OUTPUT.PUT_LINE in a file with a bash script

查看:276
本文介绍了在一个bash脚本文件打印DBMS_OUTPUT.PUT_LINE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,有一个变量PL / SQL查询。
我想DBMS_OUTPUT.PUT_LINE在机器上使用的文件(Linux版)
是否有人知道如何做到这一点?

I have a pl/SQL query that has a variable . I want DBMS_OUTPUT.PUT_LINE to a file used on the machine (linux) Does someone know how to do this?

推荐答案

您需要把一些拼凑。这里是我的灵感:<一href=\"http://stackoverflow.com/questions/10434474/dbms-output-put-line-not-printing\">DBMS_OUTPUT.PUT_LINE不打印

You need to put some pieces together. Here is my inspiration: DBMS_OUTPUT.PUT_LINE not printing

一)把你的PLSQL中的SQL脚本,例如 d.sql - 这里的关键是的 设置SERVEROUTPUT

a) put your plsql in an sql script, e.g. d.sql - the key here is set serveroutput:

set serveroutput on size 30000;
begin
   DBMS_OUTPUT.PUT_LINE('my line');
end;
/
exit

二)然后写一个脚本 - ksh的这个时候 - 包括:

b) Then write another script - ksh this time - containing:

sqlplus /  @d.sql > output.txt

如果您想从抑制的sqlplus ,然后阅读相关文档 声明

If you want to restrain what displays from sqlplus, then read appropriate documentation about set statement

这篇关于在一个bash脚本文件打印DBMS_OUTPUT.PUT_LINE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆