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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

writing to file using PL/SQL

Reply to Message Icon

Name: roopa_arjunan
Date: August 10, 2005 at 06:19:59 Pacific
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



Sponsored Link
Ads by Google

Response Number 1
Name: pcarta
Date: September 8, 2005 at 03:03:53 Pacific
Reply:

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


0
Reply to Message Icon

Related Posts

See More


Need help with WinXP batc... Windows 2000 >> Batch fil...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: writing to file using PL/SQL

Write to file noob question www.computing.net/answers/programming/write-to-file-noob-question/13381.html

write to file function www.computing.net/answers/programming/write-to-file-function/6533.html

Read/Write to a file AND Encryption www.computing.net/answers/programming/readwrite-to-a-file-and-encryption/5860.html