ORACLE file I/O withouth explicit flushing on 10g and 11g

oracleoracle-10goracle-11g-r2

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.

Best Answer

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.