Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: getting error on UTL_FILE.FOPEN

Re: getting error on UTL_FILE.FOPEN

From: Arto Viitanen <arto.viitanen_at_csc.fi>
Date: Thu, 10 Nov 2005 11:48:48 +0200
Message-ID: <4373177f$0$22413$ba624cd0@newsread.funet.fi>


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, Finland
Received on Thu Nov 10 2005 - 03:48:48 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US