Wednesday, October 21, 2009

Data Convert From a FILE to CLOB

CREATE OR REPLACE Procedure Dpr_fileToClob(Fname in VARCHAR2, Fdir in VARCHAR2, Outclob out CLOB)
IS

fclob CLOB;
theBFile BFILE;
num NUMBER :=0;
src_offset NUMBER :=1;
dest_offset NUMBER :=1;
lang_context NUMBER :=1;

BEGIN

dbms_lob.createtemporary(fclob,FALSE,DBMS_LOB.SESSION);

theBFile := BFileName(Fdir,Fname);

dbms_lob.fileOpen(theBFile);

dbms_lob.loadClobFromFile(dest_lob =>fclob,
src_bfile =>theBFile,
amount =>dbms_lob.getLength(theBFile),
dest_offset =>dest_offset,
src_offset =>src_offset,
bfile_csid =>0,
lang_context =>lang_context,
warning =>num
);

dbms_lob.fileClose(theBFile);

Outclob := fclob;

end;
/

No comments:

Post a Comment