Home » SQL & PL/SQL » SQL & PL/SQL » BLOB to file
BLOB to file [message #38050] Fri, 15 March 2002 05:39 Go to next message
Laurent MERSCH
Messages: 1
Registered: March 2002
Junior Member
I am trying to import/export BLOBs in a Oracle 8i database using only PL/SQL (no java procedure).

I curently manage to load a file into a BLOB column.
But the DBMS_LOB package doesn't allow to rewrite a file from a BLOB. ( since BFILE are read only)
It is possible to read a BLOB in a loop with dbms_lob.read. So I am looking for a package like utl_file to allow Raw data file manipulation.

The following gives an idea of what I am trying to do:

CREATE OR REPLACE PROCEDURE ReadBLOB IS
src_lob BLOB;
buffer RAW(32767);
amt BINARY_INTEGER := 32767;
pos INTEGER := 2147483647;
BEGIN SELECT b_col INTO src_lob FROM lob_table WHERE key_value = XX;
LOOP
dbms_lob.read (src_lob, amt, pos, buffer);
-- There I would like to write buffer in binary mode
pos := pos + amt;
END LOOP;
EXCEPTION WHEN NO_DATA_FOUND THEN dbms_output.put_line('End of data');
END;
Re: BLOB to file [message #38572 is a reply to message #38050] Sat, 27 April 2002 02:39 Go to previous message
Jazz
Messages: 9
Registered: April 2002
Junior Member
Laurent,

There is NO package or procedure in Oracle like UTL_FILE for what u r trying to do.

In fact, u will need to write an external procedure (user exit) to do this.
Previous Topic: Help regarding BLOB
Next Topic: Temporary Storage
Goto Forum:
  


Current Time: Thu Apr 25 14:45:46 CDT 2024