我是用的Oracle 10 g+winxp,使用的客户端计算机
我现在建了一张表blobtext ,想将我电脑硬盘上的"D:\640480背景.bmp"
1.我先以sys登陆进行了以下操作
create directory blob_dir1 as 'D:\';
grant read on directory blob_dir1 to zzh4818;
2.然后我又已zzh4818登陆
create table blobtext (id number primary key, col1 blob);
declare
a_blob blob;
fileloc bfile;
amount int;
dest_offset int:=1;
src_offset int:=1;
begin
insert into blobtext values (1,empty_blob());
select col1 into a_blob from blobtext where id = &id for
update;
fileloc := bfilename('blob_dir1','640480背景.bmp');
dbms_lob.fileopen(fileloc,0);
amount := dbms_lob.getlength(fileloc);
dbms_lob.loadblobfromfile (a_blob,fileloc,amount,dest_offset,src_offset);
dbms_lob.fileclose(fileloc);
commit;
end;
执行后,总是报如下错误:
ora-22285: 对不存在的目录或文件进行FILEOPEN操作
ora-06512:在“sys.dbms_LOB”,line 523
ora-06512:在line 12
后来又用存储过程来验证该文件是否存在
create or replace procedure filelist(in_bmp varchar2,voIntReturns
out int) is
vexits boolean;
vfile_length number;
vblocksize number;
begin
utl_file.fgetattr
('blob_dir1',in_bmp,vexits,vfile_length,vblocksize);
if vexits then
dbms_output.put_line(in_bmp||''||vfile_length);
voIntReturns:=1;
end if;
end filelist;
运行后还是找不到文件,但文件确实在本机上?请大哥们指出小弟的错误
这是我从书本上找到的有关大文件上传的例子,要是有哪位大哥能提供其他的大文件上传的好办法,小弟在此万分感谢
[ 本帖最后由 zzh481899 于 2007-12-25 14:33 编辑 ]
|