1.判斷文件是否存在(讀,重命名,複製,刪除都要判斷文件是否存在)
--判斷文件是否存在
DECLARE
ex BOOLEAN;--文件是否存在
flen NUMBER;--文件長度? 這個地方不知道怎麼理 (原文 file_length The length of the file in bytes. NULL if file does not exist.)
bsize NUMBER;--文件大小
BEGIN
utl_file.fgetattr('TESTFILE', 'hello.txt', ex, flen, bsize);
IF ex THEN
dbms_output.put_line('File Exists');
ELSE
dbms_output.put_line('File Does Not Exist');
END IF;
dbms_output.put_line('File Length: ' || TO_CHAR(flen));
dbms_output.put_line('Block Size: ' || TO_CHAR(bsize));
END fgetattr;
/