Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Insert BLOB into a BLOB column

Insert BLOB into a BLOB column

From: jaft <ftirapelle_at_gmail.com>
Date: 2 Nov 2006 05:33:36 -0800
Message-ID: <1162474416.021697.114510@h54g2000cwb.googlegroups.com>


Hi

I have a plsql stored procedure that takes a blob as input parameter. I have to insert this parameter into a table. What's the best practice to insert a new blob value into a blob column? I ask that, because I have read that before inserting a blob value into a table, I must first execute an insert statement with empty_blob() and than use the dbms_lob.write instead of inserting directly the blob value.

create table myTable (id NUMBER, ablob BLOB) /

create or replace procedure insert_blob (myBlob BLOB) as

lob_loc myTable.ABLOB%TYPE;

begin

         insert into myTable values (1, myBlob);

         --OR--

         insert into myTable values (1, empty_blob()) return ablob into lob_loc;

         dbms_lob.write (lob_loc, dbms_lob.getlength(myBlob), 1, myBlob);          

         commit;

end; Received on Thu Nov 02 2006 - 07:33:36 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US