Top
Symfoware Server V12.1.0 Application Development Guide
FUJITSU Software

B.6.3 Copying Files

Oracle database

CREATE PROCEDURE copy_file(fromname VARCHAR2, toname VARCHAR2) AS
BEGIN


    UTL_FILE.FCOPY('DIR1', fromname, 'DIR2', toname, 1, NULL); ...(7)

    RETURN;

EXCEPTION
    WHEN OTHERS THEN
        DBMS_OUTPUT.PUT_LINE('-- SQL Error --');

        DBMS_OUTPUT.PUT_LINE('ERROR : ' || SQLERRM );
        RETURN;
END;
/

set serveroutput on

call copy_file('file01.txt','file01_bk.txt');

Symfoware Server

CREATE FUNCTION copy_file(fromname VARCHAR, toname VARCHAR) RETURNS void AS $$
BEGIN
    PERFORM DBMS_OUTPUT.SERVEROUTPUT(TRUE);

    PERFORM UTL_FILE.FCOPY('/home/symfo', fromname, '/home/backup', toname, 1, NULL); ...(7)
    RETURN;

EXCEPTION
    WHEN OTHERS THEN
        PERFORM DBMS_OUTPUT.PUT_LINE('-- SQL Error --');
        PERFORM DBMS_OUTPUT.PUT_LINE('ERROR : ' || SQLERRM );
        RETURN;
END;
$$
LANGUAGE plpgsql;


SELECT copy_file('file01.txt','file01_bk.txt');

(7) FCOPY
Specification format for Oracle database

UTL_FILE.FCOPY(firstArg, secondArg, thirdArg, fourthArg, fifthArg, sixthArg)

Feature differences
Oracle database

If using a CREATE DIRECTORY statement (Oracle9.2i or later), specify a directory object name for the directory name.

Symfoware Server

A directory object name cannot be specified for the directory name.

Conversion procedure

Convert using the following procedure. Refer to UTL_FILE_DIR/CREATE DIRECTORY for information on how to check if the directory object name corresponds to the actual directory name.

  1. Locate the places where the keyword "UTL_FILE.FCOPY" is used in the stored procedure.

  2. Check the actual directory names ('/home/symfo' and '/home/backup', in the example) that correspond to the directory object names ('DIR1' and 'DIR2', in the example) of firstArg and thirdArg argument.

  3. Replace the directory object name ('DIR1' and 'DIR2', in the example) with the actual directory names ('/home/symfo' in the example) checked in step 1.