日期:2014-05-17  浏览次数:20974 次

oracle存储过程读xls,并插入数据到数据库
存储过程需要传递的参数是xls的绝对路径
------解决方案--------------------
create or replace procedure prc_orctoexcel IS
l_file utl_file.file_type;  
a VARCHAR2(1024);
BEGIN
     
     l_file :=utl_file.fopen('SJQYDIR','444.xls','w'); 
     utl_file.put_line(l_file,'测试oracle数据导入excel');
     utl_file.put(l_file,'111' 
------解决方案--------------------
 CHR(9));
     utl_file.put(l_file,'222' 
------解决方案--------------------
 CHR(9));
     utl_file.put(l_file,'333' 
------解决方案--------------------
 CHR(9));      
     utl_file.fclose(l_file);
     l_file :=utl_file.fopen('SJQYDIR','444.xls','r'); 
     utl_file.get_line(l_file,a);
     dbms_output.put_line(a);
     utl_file.fclose(l_file);
end prc_orctoexcel; 

之前写的一个在oracle中向excel写数据的例子,希望对你有帮助。
'SJQYDIR'是提前定义好的dir。