Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: getting error on UTL_FILE.FOPEN
g.muthukumar_at_gmail.com wrote:
> Hi,
> I would like anyone to help me out in this UTL_FILE issue...
>
> SQL> CREATE OR REPLACE PROCEDURE UTL_FILE_TEST_READ
> 2 IS
> 3 INPUT_FILE UTL_FILE.FILE_TYPE;
> 4 BEGIN
> 5 INPUT_FILE := UTL_FILE.FOPEN ('C:\','123.log','R');
> 6 DBMS_OUTPUT.PUT_LINE('123');
> 7 UTL_FILE.FCLOSE(INPUT_FILE);
> 8 EXCEPTION
> 9 WHEN OTHERS THEN
> 10 DBMS_OUTPUT.PUT_LINE('ERRM -> ' || SQLERRM);
> 11 END UTL_FILE_TEST_READ;
> 12 /
>
>
>
Function utl_file.fopen uses Oracle's directory objects, not operating system's directories. You create directory objects with
CREATE OR REPLACE DIRECTORY c_root as 'c:\';
and then you have to grant rights to the directory. In your case, I guess WRITE right is too much, so use
GRANT READ ON DIRECTORY c_root TO scott;
Then try utl_file.fopen(c_root, '123.log', 'r') .
-- Arto Viitanen CSC, FinlandReceived on Thu Nov 10 2005 - 03:48:48 CST