根据UTL_FILE导出数据库某个表的所有列存储过程:
create or replace procedure pmsreport as
CURSOR c1 IS
SELECT invoice_item_id,item_name FROM pms;
CURSOR c1 IS
SELECT invoice_item_id,item_name FROM pms;
item_id pms.item_id%TYPE;
item_name pms.item_name%TYPE;
item_name pms.item_name%TYPE;
OutputRecord varchar2(255);
OutputFile utl_file.file_type;
OutputFile utl_file.file_type;
BEGIN
open c1;
fetch c1 into item_id,item_name;
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;
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;
utl_file.fclose(OutputFile);
END;
测试某表两列数据1900万行5分钟导出。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16381228/viewspace-759095/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/16381228/viewspace-759095/