Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Insert BLOB - Best practice
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
![]() |
![]() |