views:

23

answers:

1

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.

+2  A: 

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

tanging
Hi, Im havin troubles with the procedure, when executed I get this message: "fallo de la operación de archivo o LOB FILEOPENEl 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.
Giancarlo Solarino
@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. (http://www.adp-gmbh.ch/ora/plsql/utl_file.html) do you have the actual error code?
tanging