I made a stupid mistake, and didn't use utl_file.fflush and utl_file.fclose after the last utl_file.putline. The procedure where utl_file is used is in a package with other procedures, this procedure is called every time a utl_file function is needed by other procedures by just passing it the necessary parameters so it will open a file, flush the buffers and close a file, write to a file, etc.

But stupid me didn't call the procedure to flush the buffers/close the file after the last write to the flat file(i.e. utl_file.putline), this has been corrected.

Now I'm trying to analyse a problem that I think might have been caused by the flat file not being closed.

After the last call to the utl_file procedure to write(i.e. utl_file.putline) the last record, the procedure was just exiting, then the process(a perl script) did some other stuff and then it calls another procedure in that same package that reads that flat file via an oracle external table.

Now finally to my question:
When does the records that were in the memory buffer get written to disk since the flat file wasn't closed?

The records are there now but I'm wondering maybe they weren't there when the last procedure that reads them was called in the process.