User Tools

Site Tools


kurs:bfile_und_lob
declare 
  v_file     bfile;
  v_filename varchar2(100);
  v_content  varchar2(4020);
  v_pic      blob;
  v_dest_offset  number := 1;
  v_src_offset   number := 1;
  v_len          number; 
begin 

 Dbms_Lob.CreateTemporary (
    lob_loc    => v_pic,
    cache      => true,
    dur        => Dbms_Lob.Session );
    
  v_file := bfilename('DIR_BILDER', 'sepp.jpg');
  insert into fotos (id, name, bild) values
    (hr_seq.nextval, 'sepp', v_file);

  dbms_lob.open(v_file, DBMS_LOB.LOB_READONLY);
--  dbms_output.put_line(dbms_lob.getlength(v_file));
   DBMS_LOB.OPEN(v_pic, DBMS_LOB.LOB_READWRITE);
  v_len := DBMS_LOB.getlength(v_file);
  --dbms_output.put_line(v_len);
  
  -- dbms_lob.loadblobfromfile(dest_lob,src_bfile,amount,dest_offset,src_offset);
--  dbms_lob.read(v_file,DBMS_LOB.LOBMAXSIZE,v_src_offset,1);
  DBMS_LOB.LoadFromFile (
          dest_lob => v_pic
        , src_lob  => v_file
        , amount   => v_len);
/*        , dest_offset => v_dest_offset
        , src_offset  => v_src_offset);*/
  --DBMS_LOB.close(v_pic); (dest_lob,src_bfile,amount,dest_offset,src_offset);
  
  dbms_lob.fileclose(v_file);
end;
kurs/bfile_und_lob.txt · Last modified: 2014/09/10 21:22 (external edit)