3

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?

ZBash
  • 31
  • 1
  • 2

1 Answers1

1

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

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

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

sqlplus /  @d.sql > output.txt

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

Community
  • 1
  • 1
J. Chomel
  • 8,193
  • 15
  • 41
  • 69