Tuesday, June 6, 2017

Oracle writing the dbms_ouput.put_line to text file from pl/sql block



spool works, the output.txt file creates the file where the pl/sql block is saved.

worked in Toad.

In order to increase the buffer size of dbms_ouptut use dbms.output.enable(NULL) whenenver needed within the pl/sql block.


spool output.txt
set serveroutput on

begin
  SELECT systimestamp FROM dual INTO time_db;
  DBMS_OUTPUT.PUT_LINE('time before procedure ' || time_db);
end;
/

spool off


Reference:
Courtesy
https://stackoverflow.com/questions/1453538/how-to-redirect-the-output-of-dbms-output-put-line-to-a-file





No comments:

Post a Comment