Oracle UTL_FILE,尝试在Windows上从文件读取并写入文件

问题描述

下面是我试图在Windows上使用的一些PL / sql代码,以读取文件文件中包含3行)并将内容写到文件中。

当我执行它时,它说“ PL / sql过程成功完成”。 但输出文件为空。

我打开了“ DBMS输出”窗口,它也不包含任何文本。

我对Oracle PL / sql不太熟悉,但是正在尝试将其用于特定项目。

TIA

set serveroutput on

DECLARE
 line varchar2(4000);

v_file utl_file.file_type;

out_file utl_file.file_type;

begin
DBMS_OUTPUT.ENABLE;
   dbms_output.put_line('B4 Open');
   
v_file := utl_file.fopen('U:\Queries-Scripts\Misc Other Queries\Balancing\Navisys-batch','NavisysActivity-testfile.txt','R');

out_file := utl_file.fopen('U:\Queries-Scripts\Misc Other Queries\Balancing\Navisys-batch','NavisysActivity-outfile.txt','W');

loop

     utl_file.get_line(v_file,line);

     utl_file.put_line(out_file,line);
     
     dbms_output.put_line(line);

   dbms_output.put_line('read a line');
   
end loop;

exception when others then

       -- The only way to kNow when we reach the end of the file is to get and exception

   dbms_output.put_line('B4 Close');
   
       utl_file.fclose(v_file);

       utl_file.fclose(out_file);
end;

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)