function get_File ( p_directory varchar2, p_file_name varchar2) return BLOB
is
l_bf BFILE;
l_amount INTEGER := 32767;
l_position INTEGER := 1;
buffer RAW(32767);
l_bb BLOB;
l_file_path varchar2(256);
begin
l_bf := bfilename( p_directory , p_file_name );
dbms_lob.open(l_bf, dbms_lob.lob_readonly);
DBMS_LOB.CREATETEMPORARY(l_bb, TRUE, DBMS_LOB.SESSION);
LOOP
begin
dbms_lob.read(l_bf,l_amount, l_position, buffer);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
end;
dbms_lob.writeappend(l_bb,l_amount,buffer);
l_position := l_position + l_amount;
END LOOP;
dbms_lob.close(l_bf);
return l_bb;
end get_File;
Wednesday, July 20, 2016
get file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment