先建立一个目录项:
create or replace directory D_OUTPUT as 'd:/';
然后建立一个存储过程:
create or replace procedure first is
vfile utl_file.file_type;
begin
vfile := utl_file.fopen('D_OUTPUT', 'hello.txt', 'w', 32767);
utl_file.put_line(vfile, 'hello');
utl_file.put_line(vfile,'world');
utl_file.fflush(vfile);
utl_file.fclose(vfile);
end;
最后执行:
exec first;
会在D盘下看到一个hello.txt.