oracle UTL_FILE的一些使用

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;
/

猜你喜欢

转载自blog.csdn.net/xumajie88/article/details/38402073
今日推荐