在一个bash脚本文件打印DBMS_OUTPUT.PUT_LINE [英] Print DBMS_OUTPUT.PUT_LINE in a file with a bash script
问题描述
我有,有一个变量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屋!