ITPub博客

首页 > Linux操作系统 > Linux操作系统 > UTL_FILE学习笔记(1)

UTL_FILE学习笔记(1)

原创 Linux操作系统 作者:deitylee 时间:2013-04-23 14:26:20 0 删除 编辑
       根据UTL_FILE导出数据库某个表的所有列存储过程:
create or replace procedure pmsreport as
       CURSOR c1 IS
              SELECT invoice_item_id,item_name FROM pms;
 
       item_id       pms.item_id%TYPE;
       item_name             pms.item_name%TYPE;
 
       OutputRecord          varchar2(255);
       OutputFile            utl_file.file_type;
 
    BEGIN
       open c1;
       fetch c1 into item_id,item_name;
 
       OutputFile:=utl_file.fopen(UPPER('RECV_AREA'),'pmsreport.csv','w',32767);
 
       WHILE c1%FOUND LOOP
          OutputRecord := item_id||','||item_name;
          utl_file.put(OutputFile,OutputRecord);
          utl_file.new_line(OutputFile);
       FETCH c1 INTO item_id,item_name;
       END LOOP;
 
       CLOSE c1;
       utl_file.fclose(OutputFile);
     END;
 
测试某表两列数据1900万行5分钟导出。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/16381228/viewspace-759095/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-10-27

  • 博文量
    74
  • 访问量
    403797