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

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

WBOY
WBOYOriginal
2016-06-07 15:50:491089browse

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;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn