Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write text file to Server

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,502
US
I have this very simple, basic proc to create a test file.
This file is created in E:\DATA location which is what (my) Oracle recognizes and writes to that default location, no problem.

Code:
CREATE OR REPLACE PROCEDURE ANDY_CREATE_FILE 
  (p_ReturnCode   	IN OUT NUMBER,
   p_VBErrorMessage IN OUT VARCHAR2)
   IS

  my_file           utl_file.file_type;
  orac_path         VARCHAR2(100)  := 'E:\DATA';

BEGIN
  my_file := utl_file.fopen(orac_path, 'ANDY_CREATE_FILE.dat', 'w');  
  utl_file.put_line(my_file, 'Some Junk Goes Here');
  utl_file.fclose(my_file);
    
   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       NULL;
     WHEN OTHERS THEN
       raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);

       --RAISE;
END ANDY_CREATE_FILE;
/

But instead of E:\DATA, I would like to write this text file to another Server location.
How can I write this text file to any Server I have privileges to?
Either a Server or my own HardDrive.

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Utl_file can ONLY write to a volume on the database server. However if you have a perminent mapping to another server you can create a directory object on it and use utl_file. The volume must be writable by the user running the database server.

Bill
Lead Application Developer
New York State, USA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top