|
スポンサード リンク
ファイルのコピーは、UTL_FILEパッケージのFCOPYを使用します。
UTL_FILE.FCOPY(
コピー元ディレクトリオブジェクト名 , コピー元ファイル名 ,
コピー先ディレクトリオブジェクト名 , コピー先ファイル名 );
|
ファイルコピー操作をする前に、コピーするユーザにディレクトリの操作権限を付与する必要があります。
create directory ディレクトリオブジェクト名 as ディレクトリパス;
grant read on directory ディレクトリオブジェクト名 to ユーザ名;
grant write on directory ディレクトリオブジェクト名 to ユーザ名;
|
※UTL_FILE.FCOPYは、Oracle9iR2から使用可能です。
例1) ユーザー「user01」にコピー元、コピー先のディレクトリに権限を付与する
|
create directory TMP as 'c:\temp'; grant read on directory TMP to user01; grant write on directory TMP to user01;
|
例2) 「c:\temp\from.txt」から「c:\temp\to.txt」にファイルをコピーする。
|
begin
utl_file.fcopy('TMP','from.txt','TMP','to.txt');
end;
|
スポンサード リンク
|