• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

UNIX oracle 10g能用utl_file包读取文件数据吗

发布: 2007-7-02 11:08 | 作者: admin | 来源: | 查看: 28次 | 进入软件测试论坛讨论

领测软件测试网


 
我在WINDOW 下ORACLE 8i利用utl_file可以读取文本文件的数据,我本人测试通过,
但是在UNIX oracle 10g不行呀!出错!
begin loadfiledata(@#d:\ora@#,@#1.txt@#); end;

ORA-29280: 目录路径无效
ORA-06512: 在 "SYS.UTL_FILE", line 33
ORA-06512: 在 "SYS.UTL_FILE", line 436
ORA-06512: 在 "WTY.LOADFILEDATA", line 20
ORA-06512: 在 line 1
=====================
我的存储过程是loadfiledata:
create or replace procedure loadfiledata(p_path varchar2,p_filename varchar2) is

v_filehandle utl_file.file_type; --定义一个文件句柄
v_text varchar2(100); --存放文本
v_name test.name%type;
v_id test.autoid%type;
v_firstlocation number;
v_secondlocation number;
v_totalinserted number;
begin
if (p_path is null or p_filename is null) then
goto to_end;
end if;
v_totalinserted:=0;
/*open specified file*/
v_filehandle:=utl_file.fopen(p_path,p_filename,@#r@#); ----打开文件,读数据
loop
begin
utl_file.get_line(v_filehandle,v_text);
exception
when no_data_found then
exit;
end ;
v_firstlocation:=instr(v_text,@#,@#,1,1);---文本文件第一个@#,@#位置
v_id:=substr(v_text,1,v_firstlocation-1);---截取文本文件第一个@#,@#之前字符串。
v_name:=substr(v_text,v_firstlocation+1);
/*插入数据库操作*/
begin
insert into test
values (v_id,v_name);
if sql%rowcount=0 then
rollback;
else
commit;
end if;
exception
when others then
rollback;
end;
end loop;
<<to_end>>
utl_file.fclose(v_filehandle);
null;

end loadfiledata;
===========
loadfiledata存储过程在WINDOW ORALCE 8I运行正常,但是为什么在UNIX ORACLE 1OG 不行,
是不是在UNIX ORACLE 1OG 对utl_file包发生变化呀!
大家帮帮忙呀!

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网