Home » SQL & PL/SQL » SQL & PL/SQL » code to FTP the spool file from Sqlplus to the unix server.
code to FTP the spool file from Sqlplus to the unix server. [message #277660] Wed, 31 October 2007 01:48 Go to next message
vprevin
Messages: 1
Registered: October 2007
Junior Member
I have a sqlplus report and inside that report I have the following piece of code to mail the report output to the email id.

My requirement is, instead of emailing the output I want to FTP that script to a different unix server (say ip as 10.10.1.1). How to modify this code to FTP the spool file to the unix server.

IF :g_email_to IS NOT NULL THEN
SELECT name INTO :g_dbname FROM v$database;
:g_host_cmd := 'echo "sending email ..."; sync; sync; sync; '||'uuencode '||:g_spool_file||' '||:g_attach_file
||' | mailx -r "oraclefinancials_'||:g_dbname||'"';
:g_host_cmd2 := 'cat '||:g_spool_file||' >> '||:g_outfile;

IF :g_prog_title IS NOT NULL THEN
IF instr(:g_prog_title,' ') > 0 THEN
v_quote := '''';
ELSE
v_quote := NULL;
END IF;
:g_host_cmd := :g_host_cmd||' -s '||v_quote||:g_prog_title||v_quote;
END IF;

IF instr(:g_email_to,' ') > 0 THEN
v_quote := '''';
ELSE
v_quote := NULL;
END IF;
:g_host_cmd := :g_host_cmd||' '||v_quote||:g_email_to||v_quote||'; echo done';
ELSE
:g_spool_file := NULL;
:g_host_cmd := 'exit';
:g_host_cmd2 := 'exit';
END IF;
Re: code to FTP the spool file from Sqlplus to the unix server. [message #277663 is a reply to message #277660] Wed, 31 October 2007 01:54 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Always post your Oracle version (4 decimals).

Regards
Michel
Re: code to FTP the spool file from Sqlplus to the unix server. [message #277668 is a reply to message #277663] Wed, 31 October 2007 02:08 Go to previous message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Just a clue: you are not the first to ask for FTP from PL/SQL.

Regards
Michel
Previous Topic: data is not populating through dblink
Next Topic: to find out largest table in particular user
Goto Forum:
  


Current Time: Fri Dec 02 20:44:38 CST 2016

Total time taken to generate the page: 0.14117 seconds