Computing.Net > Forums > Programming > writing to file using PL/SQL

writing to file using PL/SQL

Reply to Message Icon

Original Message
Name: roopa_arjunan
Date: August 10, 2005 at 06:19:59 Pacific
Subject: writing to file using PL/SQL
OS: windows
CPU/Ram: unknown
Comment:

Hi,
I want to how to write to a file using UTL_FILE.I wrote the following code but its giving the error as follows:


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


and my code is


DECLARE
filehandler UTL_FILE.FILE_TYPE;
BEGIN
dbms_output.put_line('begin');
filehandler:=UTL_FILE.FOPEN('/','example','w');
dbms_output.put_line('begin1');
UTL_FILE.PUT_line(filehandler,'welcome!!!!!\n');
dbms_output.put_line('begin2');
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;
/


Please tell me how to give the directory name.I dont have privilege to create a new directory so what i have to do and where to write the file.

Thanks,
Roopa.A


Report Offensive Message For Removal

Response Number 1
Name: pcarta
Date: September 8, 2005 at 03:03:53 Pacific
Subject: writing to file using PL/SQL
Reply: (edit)

Hi,

filehandler:=UTL_FILE.FOPEN('/','example','w');
^-that is not an windows directory ('c:\')

in the init.ora file you have also to insert UTL_FILE_DIR = 'c:\'

Maybe in the init.ora is an value for UTL_FILE_DIR, so you have to insert this as the FOPEN(''.... Parameter.

kind regards

Pascal


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: writing to file using PL/SQL

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software