3

I need to generate a txt from oracle and put it into a ftp server, I already make the st for build de file but is it possible to transfer it to a ftp directly from the SP???

Thanks.

1 Answer 1

3

you sure can (not sure what version of Oracle you are on but as long as it is 9i++ you ought to be safe).

You will need to utilize a combination of UTL_FILE (to write the file) and then utl_tcp (to do the actual ftp'ing of the file).
This link covers this approach (and also introduces a few others) in good detail with examples. http://www.oracle-base.com/articles/misc/FTPFromPLSQL.php

2
  • Hi, Im havin troubles with the procedure, when executed I get this message: "fallo de la operación de archivo o LOB FILEOPEN El sistema no puede hallar el archivo especificado." Which means that operation failed, the system can not find the file. I found strange the first line: "CREATE OR REPLACE DIRECTORY my_docs AS '/u01/app/oracle/';" because dont allow me to create this in any part of the procedure, I think there may be the problem, but althow I dont get if this create line actualyy creates a directory or it creates a variable or an object. Oct 26, 2010 at 12:59
  • @Giancarlo Solarino utl_file can only write to the server (which I believe is what you are doing). It may be possible that the directory it is writing to Oracle/UTL_FILE lack access. You may need to reach out to the DBA to get/find a temp directory that the utl_file has access to. (adp-gmbh.ch/ora/plsql/utl_file.html) do you have the actual error code?
    – Harrison
    Oct 26, 2010 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.