Home » SQL & PL/SQL » SQL & PL/SQL » Creating a text file in PL/SQL ( Urgent !!!!!!!!!!!!!)
Creating a text file in PL/SQL ( Urgent !!!!!!!!!!!!!) [message #39978] Thu, 29 August 2002 22:35 Go to next message
kiran
Messages: 503
Registered: July 2000
Senior Member
Hi all,

I facing a problem in creating textfile from within my pl/sql block, Please go thru the code and tell me am i have to set any thing else(should i have the permission to create a file or is it default?)

The code is as follows

Set Serveroutput On

DECLARE
fileHandler UTL_FILE.FILE_TYPE;
BEGIN
fileHandler := UTL_FILE.FOPEN('UTL_FILE_TEST', 'test.txt', 'w');
UTL_FILE.PUTF(fileHandler, 'Hi Look at this, I''m writing to a file!!!n');
UTL_FILE.FCLOSE(fileHandler);
EXCEPTION
WHEN utl_file.invalid_path THEN
raise_application_error(-20000, 'ERROR: Invalid path for file or path not in INIT.ORA.');
END;

The error I'm getting is

ERROR at line 1:
ORA-20000: ERROR: Invalid path for file or path not in INIT.ORA.
ORA-06512: at line 9

reply immdtly
ThanQ
Re: Creating a text file in PL/SQL ( Urgent !!!!!!!!!!!!!) [message #39982 is a reply to message #39978] Fri, 30 August 2002 04:12 Go to previous message
Dan
Messages: 61
Registered: February 2000
Member
At the bottom of my INIT.ORA file I added

UTL_FILE_DIR = *

I used the * becuase I am only on my development machine. When it goes to production it will be something like

UTL_FILE_DIR = c:mydirectory
Previous Topic: problem with htp.p
Next Topic: Re: SID ?
Goto Forum:
  


Current Time: Thu Apr 25 11:48:33 CDT 2024