2019-07-26 输出查询到文本

create or replace Directory FILEWRITE as 'X:\';

  grant read,write on Directory FILEWRITE to public; 

  declare

    fileID utl_file.file_type;

  begin

    fileid := utl_file.fopen('FILEWRITE', 'xxx.xx', 'w');

    for REC in (select * from X.x) loop

      begin

        utl_file.put_line(fileid, Rec.Bcpcmd);

      end;

    end loop;

    utl_file.fclose(fileID);

    if utl_file.is_open(fileID) then

      utl_file.fclose(fileID);

    end if;

  end;

/

exit; 

你可能感兴趣的:(2019-07-26 输出查询到文本)