Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    6

    Unanswered: UTL_FILE question

    I am using a cursor to fetch value into a variable, then write this variable to a file.

    QUESTION:
    *********

    Everytime the loop is executed, the variable v_select is written to a new line in the file.

    Is there a way to ignore line feed and write the entire output in ONE SINGLE line?


    CODE:
    ******************************
    BEGIN
    id := UTL_FILE.FOPEN('/mydir','myfile,'a');
    UTL_FILE.PUT_LINE(id,'myfile');
    LOOP
    FETCH p_Cur INTO v_select;
    EXIT WHEN p_Cur%NOTFOUND;
    UTL_FILE.PUTF(id,v_select);
    END LOOP;
    UTL_FILE.FCLOSE(id);
    CLOSE p_Cur;
    END;
    *******************************

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1

    Re: UTL_FILE question

    Originally posted by badcoder
    I am using a cursor to fetch value into a variable, then write this variable to a file.

    QUESTION:
    *********

    Everytime the loop is executed, the variable v_select is written to a new line in the file.

    Is there a way to ignore line feed and write the entire output in ONE SINGLE line?


    CODE:
    ******************************
    BEGIN
    id := UTL_FILE.FOPEN('/mydir','myfile,'a');
    UTL_FILE.PUT_LINE(id,'myfile');
    LOOP
    FETCH p_Cur INTO v_select;
    EXIT WHEN p_Cur%NOTFOUND;
    UTL_FILE.PUTF(id,v_select);
    END LOOP;
    UTL_FILE.FCLOSE(id);
    CLOSE p_Cur;
    END;
    *******************************
    It is DOING what you told it to do.
    Guess what "PUT_LINE" does?
    It outputs a characters and then a NEW_LINE character at the end.
    Your solution is to stop using PUT_LINE.

Posting Permissions

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