Home » RDBMS Server » Server Utilities » UTL_FILE
UTL_FILE [message #171599] Wed, 10 May 2006 09:11 Go to next message
brandointheweb
Messages: 25
Registered: August 2005
Location: Germany
Junior Member
Hello from Germany,
I try to use the UTL_FILE function!
The main thing I#m interested in is to write the result of my View to a certain .txt-file!
But as I'm quite new with this I first tried following:

UTL_FILE_DIR = E:\Digital_Data\TEST
DECLARE
   v_file UTL_FILE.FILE_TYPE;
   i      NUMBER;
BEGIN
   --UTL_FILE_DIR = E:\Digital_Data\TEST
   v_file := UTL_FILE.FOPEN('E:\DIGITAL_DATA\TEST','test.txt', 'w');
   UTL_FILE.PUT_LINE(v_file,'            Überschrift');
   UTL_FILE.NEW_LINE (v_file);
   For i IN 1..10 LOOP
   --UTL_FILE.PUT_LINE(v_file,'Erste Zeile');    
   --....
         UTL_FILE.PUT_LINE(v_file,TO_CHAR(i) || '-te Zeile');
   END LOOP;
   UTL_FILE.FCLOSE(v_file);
END; 


But as I do this I get following errors:

ORA-29280: Ungültiger Verzeichnispfad
ORA-062512: in "SYS.UTL_FILE", Zeile 18
ORA-06521: in "SYS.UTL_FILE", Zeile 424

Can someone give me an hint whats wrong or how to solve my wish to write my view to a file?!

Thanks and regards
Marlon
Re: UTL_FILE [message #171603 is a reply to message #171599] Wed, 10 May 2006 09:21 Go to previous messageGo to next message
kmsalih
Messages: 197
Registered: March 2006
Senior Member
sho parameter utl_file_dir
send the result
Re: UTL_FILE [message #171613 is a reply to message #171603] Wed, 10 May 2006 09:50 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
First, UTL_FILE_DIR is init.ora parameter.
Second, UTL_FILE_DIR is outdated. In 9i and 10g use Create directory.
Third, Please search before posting.

http://www.orafaq.com/forum/m/167078/42800/#msg_167078
Re: UTL_FILE [message #171732 is a reply to message #171613] Thu, 11 May 2006 05:26 Go to previous messageGo to next message
kmsalih
Messages: 197
Registered: March 2006
Senior Member
Thanks Mahesh
Re: UTL_FILE [message #172294 is a reply to message #171599] Mon, 15 May 2006 20:31 Go to previous messageGo to next message
harman_deep
Messages: 8
Registered: August 2005
Location: Amritsar
Junior Member

I think as mentioned that UTL_DIR is outdated...
I think it is still supported not outdated although we have new feature of directory

Correct me if I am wrong..
Re: UTL_FILE [message #172358 is a reply to message #172294] Tue, 16 May 2006 03:23 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
UTL_FILE_DIR outdated and not recomended to use.
UTL_FILE_DIR is still there. It is upto you to use it. But never call Oracle support if you have any problems with it.
REFER DOCUMENTATION for 9i that is released atleast 4 years before.

http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/u_file.htm#998101
Quote:


In the past, accessible directories for the UTL_FILE functions were specified in the initialization file using the UTL_FILE_DIR parameter. However, UTL_FILE_DIR access is not recommended. It is recommended that you use the CREATE DIRECTORY feature, which replaces UTL_FILE_DIR. Directory objects offer more flexibility and granular control to the UTL_FILE application administrator, can be maintained dynamically (that is, without shutting down the database), and are consistent with other Oracle tools. CREATE DIRECTORY privilege is granted only to SYS and SYSTEM by default.
Note:

use the CREATE DIRECTORY feature instead of UTL_FILE_DIR for directory access verification.
Previous Topic: Load LOB data !!
Next Topic: Import using Toad
Goto Forum:
  


Current Time: Sat Jun 29 09:38:13 CDT 2024