Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    19

    Question Unanswered: UTL_FILE.PUT usage

    I was recently using UTL_FILE.PUT_LINE to write to a text file but realized that the carriage returns PUT_LINE adds were screwing my output up. So I changed the package to UTL_FILE.PUT but now it writes an empty file.... no data at all. I'm wondering if the usage for PUT is the same as it is for PUT.LINE. Here is a sample of my script with PUT instead of PUT_LINE (works fine with PUT_LINE but not with PUT):


    LBL_TEXT := 'TEXT HERE';


    LBL_OUTPUT := UTL_FILE.FOPEN(OUTPUTPATH,
    LBL_FNAME,
    'W');


    UTL_FILE.PUT(LBL_OUTPUT,
    LBL_TEXT);

    END;
    /

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: UTL_FILE.PUT usage

    This is from the documentation (always worth a read!):


    When you call PUT_LINE, the item that you specify is automatically followed by an end-of-line marker. If you make calls to PUT to build a line, then you must add your own end-of-line marker by calling NEW_LINE. GET_LINE and GET_LINES do not return lines that have not been terminated with a newline character.
    Also, you need to close the file with FCLOSE.

Posting Permissions

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