atgc的博客
===========================================================
保存图片到BLOB字段
===========================================================

create or replace directory photo_dir as 'C:';
create table photos (photo BLOB);

declare
a_blob BLOB;
a_bfile BFILE := BFILENAME('PHOTO_DIR','test.jpg');
begin
insert into photos values (empty_blob())
returning photo into a_blob;
dbms_lob.fileopen(a_bfile);
dbms_lob.loadfromfile(a_blob, a_bfile, dbms_lob.getlength(a_bfile));
dbms_lob.fileclose(a_bfile);
commit;
end;
/

PL/SQL 过程已成功完成

验证是否存入了图片
select dbms_lob.getlength(photo) from photos;
DBMS_LOB.GETLENGTH(PHOTO)
-------------------------
608474


atgc 发表于:2006.10.07 17:12 ::分类: ( 技术文章 ) ::阅读:(208次) :: 评论 (1)
re: 保存图片到BLOB字段 [回复]

哥们,你这个是不是在10G做的?是不是要先建立一个ORACLE可以直接读取OS的那个目录,然后再用你的程序

LD 评论于: 2006.12.29 15:00

发表评论
标题

在此添加评论
表情符号: smile laughing tongue angry crying sad wassat wink

称呼

邮箱地址(可选)

个人主页(可选)




切换风格
新闻聚合
博客日历
文章归档...
最新发表...
博客统计...
网站链接...