使用存储过程向Oracle数据库中插入BLOB文件

create or replace procedure MyPre_IMPORTMap(nMapid in varchar2,

 nFilename in varchar2, nFilecon out blob,nlastfile in number,

 nfilelevel in number )is

 

 num number;

 recordnum number;

 

begin

  select SEQ_SYS_FILE_NUM.NEXTVAL into num from dual;

  select count(sys_file.file_num) into recordnum from sys_file

  where sys_file.file_name = nFilename and sys_file.map_id = nMapid;

  if recordnum > 0 then

  begin

       update sys_file set sys_file.file_con = empty_blob()

       where sys_file.file_name = nFilename

       and sys_file.map_id = nMapid

       returning sys_file.file_con

       into nFilecon;

  end;else

  begin

       insert into sys_file values(num,nMapid,nFilename,empty_blob(),

       nlastfile,nfilelevel)

       returning sys_file.file_con

       into nFilecon;

 end;end if;

end MyPre_IMPORTMap

你可能感兴趣的:(使用存储过程向Oracle数据库中插入BLOB文件)