This is written in PL/SQL on an Oracle 8i server.

I have the following code. When I run it, filegetname accurately returns dir_alias as WQA_DIR and file_name as May1.ftp. The file May1.ftp does, in fact, exist in "E oracle\trace" which is what is specified in WQA_DIR. The file is out on the server, not on a client machine. I am running as an administrator so I should have full privileges on everything.

The problem is that fileexists returns a 0. Why does this not recognize the fact that the file is in the designated location?

The problem is then compounded when I try to perform the .fileopen
because the file appears to not exist.

Thanks.

fil BFILE;
dir_alias VARCHAR2(30);
file_name VARCHAR2(2000);
buf RAW(4000);
amt BINARY_INTEGER;
BEGIN
FOR l_rec IN l_cur LOOP
DECLARE
CURSOR l_cur_locator IS
SELECT qa_test
FROM wqa
WHERE qa_question_id = l_rec.qa_question_id;
BEGIN
FOR l_rec_locator IN l_cur_locator LOOP
fil := l_rec_locator.qa_test;
dbms_lob.filegetname(fil, dir_alias, file_name);
IF dbms_lob.fileexists(fil) = 1 THEN
dbms_lob.fileopen(fil, dbms_lob.file_readonly);
amt := dbms_lob.getlength(fil);
dbms_lob.read(fil, amt, 1, buf);
dbms_lob.fileclose(fil);
END IF;
END LOOP;
END;
END LOOP;