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

Home -> Community -> Usenet -> c.d.o.misc -> Insert BLOB - Best practice

Insert BLOB - Best practice

From: jaft <ftirapelle_at_gmail.com>
Date: 2 Nov 2006 21:58:17 -0800
Message-ID: <1162533497.140127.21110@h48g2000cwc.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 - 23:58:17 CST

Original text of this message

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