Logging dbms_output.put_line to file
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 9 of 9

Thread: Logging dbms_output.put_line to file

  1. #1
    Join Date
    Sep 2001
    Posts
    44
    Hi,
    Is it possible to log the output of dbms_output.put_line() to a file?

  2. #2
    Join Date
    Apr 2002
    Location
    Philippines
    Posts
    77
    You can use UTL_FILE package to write the messages to a file.

    skid

  3. #3
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    sure, use the spool command.
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  4. #4
    Join Date
    Sep 2001
    Posts
    44
    Hi,
    Can u plz give me an example of how to use it..
    I am new to Oracle db


    Originally posted by skid
    You can use UTL_FILE package to write the messages to a file.

    skid

  5. #5
    Join Date
    Jan 2001
    Posts
    2,828

    Talking

    Hi

    set echo off
    set feedback off
    set verify off
    set heading off
    spool test.txt
    declare
    begin
    dbms_output.put_line('hello');
    end;

    now do cat text.txt

    regards
    Hrishy

  6. #6
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712

    Wink

    set echo off
    set feedback off
    set verify off
    set heading off
    set serveroutput on size 65536
    spool test.txt
    begin
    dbms_output.put_line('hello');
    end;
    /
    spool off

    now
    do cat test.txt
    ... if you're on unix. If you're on Win use notepad or your favourite text editor.



    [Edited by ales on 04-29-2002 at 07:11 AM]

  7. #7
    Join Date
    Sep 2001
    Posts
    44

    Question

    Hi,
    I executed what u mentioned but...this is what I got in test.txt

    SQL> declare
    2 begin
    3 dbms_output.put_line('hello');
    4 end;
    5 /
    hello
    SQL> spool off

    I want just the output of dbms_output.put_line to be captured in the file..in this case 'hello'
    Hope u will help me..

    ....


    Originally posted by ales
    set echo off
    set feedback off
    set verify off
    set heading off
    set serveroutput on size 65536
    spool test.txt
    begin
    dbms_output.put_line('hello');
    end;
    /
    spool off

    now
    do cat test.txt
    ... if you're on unix. If you're on Win use notepad or your favourite text editor.



    [Edited by ales on 04-29-2002 at 07:11 AM]

  8. #8
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    If you write the commands interactively you see them always in the output file. Put the commands in a file (test.sql) and then call it either with "start test" or "@test".
    If you don't want to see the output on the screen add "set termout off".

  9. #9
    Join Date
    Apr 2013
    Posts
    1
    Thanks Buddy. Gave me the answer I needed. It was obvious to put the set serveroutput on ... But only after reading your post. Save me a lot of time. Thanks again.

    Serge.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width