1

what happens, if I open a file (foo := utl_file.fopen(... ), write multiple times to a file ( utl_file.put_line (foo,bar) ) and close it ( utl_file.fclose(foo) ) without any flushing?

Is there a difference between the versions 10g and 11g? Is the output deterministic?

Thank you

Edit 1: I am asking because we got some missing characters in a huge output file at some points where the 7FFF (= 32767) byte is full and the 32768th byte would be written. This error exists only since the update from 10g to 11g. The error in the code might be a missing flush, but we don't get any exceptions and it was working before the update. The issue is not with every 32768th byte.

  • 1
    Is there a reason you don't want to flush or are you just curious? – Jack says try topanswers.xyz Dec 4 '13 at 15:46
  • We had some buggy code, which worked without flushing on 10g but on 11g we get this error. So I tried to figure out what caused the error. We tried to write two files (one with flush, one without) but the error is in both files – user30137 Dec 13 '13 at 12:08
1

According to the documentation for

10g http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/u_file.htm#i1003326

11g http://docs.oracle.com/cd/E11882_01/appdev.112/e40758/u_file.htm#ARPLS70908

and

12c http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/u_file.htm#i1003326

If there is buffered data yet to be written when FCLOSE runs, then you may receive a WRITE_ERROR exception when closing a file.

So you should call utl_file.fflush(foo); before closing.

  • Thank you for your post. I added some more text for clarification. Please see "Edit 1". – user30137 Nov 4 '13 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.