Home > appendStream  [1 example]

 Appends the content of the source file to the destination file.  If the
destination file doesn't exist, the destination file is created with the
contents from the source file.

 Examples

SET SERVEROUTPUT ON SIZE 1000000;
DECLARE
  fid VARCHAR2(80);
  host VARCHAR2(80)   := '[replace with ftp address]';
  usernm VARCHAR2(80) := '[replace with ftp username]';
  passwd VARCHAR2(80) := '[replace with ftp password]';
BEGIN
  fid := fclient_p.createFTPClient;
  fclient_p.login(fid, host, usernm, passwd);
  
  -- appendStream(handle, destination file, source file);
  fclient_p.appendStream(fid, '/home/tester/testclasses.jar', 'c:\winnt\notepad.exe');

  fclient_p.logout(fid);
  fclient_p.remove(fid);
EXCEPTION
  WHEN fclient_p.java_failed THEN
    DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_p.getErrorWithResponse(fid), 1, 255));
END;
/

If you need to check if appendStream is successful add the following snippet of code immediately after the call to appendStream: IF fclient_p.getLastResponseReturnCode(fid) = '226' THEN DBMS_OUTPUT.PUT_LINE('Successfully Append'); ELSE DBMS_OUTPUT.PUT_LINE(SUBSTR('Failed to append, Reason :'||REPLACE(fclient_p.getLastResponse(fid), CHR(10)), 1, 255)); END IF;

 Related Commands
 appendTextToStream
 
© 1999-2003 Bear Claw Inc.