GRANT READ, WRITE ON DIRECTORY TEMP_DIR TO test;
CREATE OR REPLACE FUNCTION file_to_blob (p_dir IN VARCHAR2,
p_filename IN VARCHAR2)
RETURN BLOB
AS
l_bfile BFILE;
l_blob BLOB;
l_dest_offset INTEGER := 1;
l_src_offset INTEGER := 1;
BEGIN
l_bfile := BFILENAME(p_dir, p_filename);
DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);
DBMS_LOB.createtemporary(l_blob, FALSE);
IF DBMS_LOB.getlength(l_bfile) > 0 THEN
DBMS_LOB.loadblobfromfile (
dest_lob => l_blob,
src_bfile => l_bfile,
amount => DBMS_LOB.lobmaxsize,
dest_offset => l_dest_offset,
src_offset => l_src_offset);
END IF;
DBMS_LOB.fileclose(l_bfile);
RETURN l_blob;
END file_to_blob;
/
https://oracle-base.com/articles/misc/apex_data_parser#xml
No comments:
Post a Comment