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?
            Asked
            
        
        
            Active
            
        
            Viewed 4,515 times
        
    1 Answers
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 sqlplus, then read appropriate documentation about set statement
 
     
    