Username: Password:

UNIX oracle 10g能用utl_file包读取文档数据吗?-数据库专栏,ORACLE
来源:作者: 发布时间:2007-12-25 13:42:58

unix oracle 10g能用utl_file包读取文档数据吗?
我在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;
<>
utl_file.fclose(v_filehandle);
null;

end loadfiledata;
===========
loadfiledata存储过程在window oralce 8i运行正常,但是为什么在unix oracle 1og 不行,
是不是在unix oracle 1og 对utl_file包发生变化呀!
大家帮帮忙呀!
我的个人网站http://www.kao99.com

喜欢本文,那就收藏到:

    Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网
相关评论  我也要评论
还没有关于此文章的相关评论!
  • 昵称: (为空则显示guest)
  • 评论分数: ★ ★ ★★★ ★★★★ ★★★★★
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 导航
    赞助商
    文章类别
    订阅