#1 05 Jan 2008 09:40

krishnaindia
Member
Registered: 05 Jan 2008
Posts: 1

Creating Text File Using UTL_FILE

Hi,

While creating a text file using utl_file I am getting error message ora-29280: invalid directory path.

In server i have set path as
utl_file_dir = 'd:\orahome\bin'  ( Init.ora file)

Procedure code is
CREATE OR REPLACE PROCEDURE  test_filehandling AS

FILEHANDLE           UTL_FILE.FILE_TYPE;
WRITEMEASSAGE   VARCHAR2(200);

BEGIN

FILEHANDLE        := UTL_FILE.FOPEN('\\10.15.1.197\d\orahome\bin','test.txt','w');
WRITEMESSAGE  := 'This is created for testing purpose \n' || ' \n This is the second line';
UTL_FILE.PUTF(filehandle,writemessage);
UTL_FILE.FFLUSH(filehandle);
UTL_FILE.FCLOSE(filehandle);
END;
/

Could anyone suggest me what is wrong with the code?

Regards
Krishna

Offline

#2 05 Jan 2008 12:27

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 899
Website

Re: Creating Text File Using UTL_FILE

This is probably permissions on the folder/share

Try using Create DIRECTORY - see here http://ss64.com/ora/directory_c.html

also spelling: WRITEMEASSAGE

Offline

#3 28 Jan 2008 05:44

vrajput
Member
Registered: 28 Jan 2008
Posts: 1

Re: Creating Text File Using UTL_FILE

Dear user,
  Try this:
      make a directory object for your path:
         CREATE OR REPLACE DIRECTORY D1 AS 'C:\ORACLE\BIN';
    Then call the function to open the file:
          F := UTL_FILE.FOPEN('D1', 'text.txt', 'w');
  Remember, the directory name passes to the function should be in capitals.

All the best.

Offline

Board footer

Powered by FluxBB