Hi, here is an example of how I load an archive, I download using java,
because a bug, so I can't give you an example
don't forget to create directory and give privileges
FUNCTION LeeArchivo( cFile VARCHAR2, cDirectory VARCHAR2, bArchivo IN OUT
BLOB) RETURN VARCHAR2 IS
b_blob BLOB;
b_bfile BFILE;
cPath VARCHAR2(150);
cReturn VARCHAR2(2000);
BEGIN
cReturn := 'Open File, debe darse GRANT READ/WRITE ON DIRECTORY TO DAZ.';
b_bfile := BFILENAME( cDirectory , cFile );
cReturn := 'Creating temporary.';
DBMS_LOB.CREATETEMPORARY(b_blob,TRUE);
cReturn := 'Opening lobs.';
DBMS_LOB.OPEN(b_blob,DBMS_LOB.LOB_READWRITE);
DBMS_LOB.OPEN(b_bfile, DBMS_LOB.LOB_READONLY);
cReturn := 'Loading file:Dir:'||cDirectory||'-Arch:'||cFile||'-length:(
||DBMS_LOB.GETLENGTH( b_bfile )||')';
DBMS_LOB.LOADFROMFILE (b_blob,b_bfile, DBMS_LOB.GETLENGTH( b_bfile ));
cReturn := 'Close.';
DBMS_LOB.CLOSE(b_bfile);
DBMS_LOB.CLOSE(b_blob);
bArchivo :=b_blob;
cReturn := 'Free temporary.';
DBMS_LOB.FREETEMPORARY(b_blob);
RETURN 'T';
EXCEPTION WHEN OTHERS THEN
RETURN 'F-'||cReturn || SQLERRM;
END;
Please see the official ORACLE-L FAQ:
http://www.orafaq.com
To unsubscribe send email to: oracle-l-request_at_freelists.org
put 'unsubscribe' in the subject line.
--
Archives are at
http://www.freelists.org/archives/oracle-l/
FAQ is at
http://www.freelists.org/help/fom-serve/cache/1.html
Received on Mon Jun 28 2004 - 16:19:04 CDT