当前位置:Gxlcms > mysql > Oracle数据库使用存储过程上传大图片blob参数,上传失败怎么会

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

时间:2021-07-01 10:21:17 帮助过:73人阅读

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;

人气教程排行