Inter Process File Handling Problem

Hi All,

i am running a oracle procedure which writes a file . The same file is picked up by another script which runs in a cron after every 5 minutes.

Now the problem is that sometimes my script picks up a file while the procedure is still writing data in the file.

is there is any way i can lock my file, so that no other process process a file while one is still processin the file.

Thanx in advance

Saurabh

Write the file with some screwy name that the cron script will not be looking for. After the oracle procedure finishes writing the file, rename the file to the proper name.

In this case i have to create another script to rename the file first. and how will i detect the screwy name file has been completly written before renaming it.

Write a script with two lines. First line: oracle procedure. Second line: rename file. Somehow you will need to modify the oracle procedure to write to the screwy name. Can't do that? Then the current name is now the screwy name. Rename it to something else. And modify your other script to now look for the new name.

spool in sql scripts writes files, unless you call UTL_FILE. In either event you can name an output file anything you want.

In an Oracle sql script the HOST command lets you execute a shell command like

HOST mv screwyfilename.txt goodfilename.txt