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;