Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

utl_file - how to identify whether a file exists?

523861May 29 2013 — edited May 29 2013
Hi guys - sorry for the newbie type question:

using
---Database Version---
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
I'm maintaining a system we're using a cutting edge 1980's method of writing data to a file using utl_file.

The files are currently opened in Append mode with the file name containing the current date/time down to the second.

my current issue is when two processes are executing the same code simultaneously we get files containing data from both processes with all the ugliness that ensues...

What's the best way to check whether the file exists prior to writing to it?

I was thinking opening it in readonly mode and checking whether I get a file handle or not - is that the correct way?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 26 2013
Added on May 29 2013
10 comments
3,504 views