DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Writing to a local file from a procedure

  1. #1
    Join Date
    Aug 2000
    Location
    Ny
    Posts
    105
    Can any one tell me how can I writh to a local file (C:/my_file.txt) from a procedure. I need to create sql statments and store them in a file for later execution.

    I need to do this into a LOCAL file so I don't think that I can use UTL_FILE, is there any way to spool from a proc to a file??? or any other way to do this???

    Thanks.

  2. #2
    Join Date
    Nov 2000
    Posts
    344
    Have you looked at DBMS_OUTPUT?

    Assuming you are running your procedure from SQL*Plus,
    you should be able to do what you want.

    enter the following in SQL*Plus :

    spool c:\my_file.txt
    set serveroutput on

    -- this is the buffer size for the text
    -- you are going to output from your
    -- procedure. make it bigger if you need to.
    execute dbms_output.enable(100000);

    -- call your procedure...
    execute my_procedure;

    -- turn off dbms_output
    set serveroutput off;
    spool off;


    in your procedure, you can spool text like this :

    dbms_output.put_line('whatever');


  3. #3
    Join Date
    Aug 2000
    Location
    Ny
    Posts
    105
    thanks jdorlon, I know about dbms_output but I wanted to have a "cleaner" way of doing it, I want the user to just execute the procedure and a file will be writen.

  4. #4
    Join Date
    Oct 2000
    Posts
    123
    Have u tried "text_io" package?

    Take care

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