欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle数据库使用存储过程上传大图片 blob参数 ,上传失败怎么会

程序员文章站 2024-02-03 14:49:34
...

procedure proc1( Attachmen in out blob, --附件 ) is i integer; atta blob; begin dbms_lob.createtemporary(atta,true); select we.nextval into i from dual; insert into t_TrafficInfor (id,Attachment) values(i,EMPTY_BLOB()); if(Attachmen is not

procedure proc1(

Attachmen in out blob, --附件

)
is
i integer;
atta blob;
begin
dbms_lob.createtemporary(atta,true);
select we.nextval into i from dual;

insert into t_TrafficInfor
(id,Attachment)
values(i,EMPTY_BLOB());
if(Attachmen is not null)then
select Attachment into atta
from t_TrafficInfor
where id=i for update;
--打开DBMS_LOB()包
dbms_lob.open(Attachmen,dbms_lob.lob_readonly);
DBMS_LOB.OPEN(atta, DBMS_LOB.lob_readwrite);
--追加要插入的照片到指定位置
--DBMS_LOB.append(atta,attachmen);
dbms_lob.write(atta,500000,0,Attachmen);
dbms_lob.close(Attachmen);
dbms_lob.close(atta);
end if;
end;