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: Maxim Demenko <mdemenko_at_arcor.de>
Date: Thu, 10 Nov 2005 14:37:59 +0100
Message-ID: <43734d7a$0$21944$9b4e6d93@newsread2.arcor-online.net>


DA Morgan schrieb:

> Muthu Kumar G wrote:
> 

>> Arto,
>> Thanks for your help. But i guess you missed out the alternate part.
>>
>>
>> <-------------- OR ---------->
>>
>> SQL> CREATE OR REPLACE DIRECTORY MY_OUT AS 'C:\';
>>
>> Directory created.
>>
>> 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 ('MY_OUT','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 /
>>
>> Procedure created.
>>
>> SQL> EXEC UTL_FILE_TEST_READ;
>> ERRM -> ORA-29283: invalid file operation
>> ORA-06512: at "SYS.UTL_FILE", line
>> 475
>> ORA-29283: invalid file operation
>>
>> PL/SQL procedure successfully completed.
>>
>> SQL>
> 
> 
> Did you grant READ on the directory?
> 
> And why would you choose the root? That is bad practice on any o/s.
> 
> Working demos can be found in Morgan's Library at www.psoug.org
> click on UTL_FILE.

 From
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5007.htm#sthref5036

<quote>
When you create a directory, you are automatically granted the READ and WRITE object privileges on the directory, and you can grant these privileges to other users and roles. The DBA can also grant these privileges to other users and roles.
</quote>

Best regards

Maxim Received on Thu Nov 10 2005 - 07:37:59 CST

Original text of this message

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