INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Write text file to Server

Write text file to Server

(OP)
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.

RE: Write text file to Server

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close