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 -> Re: How to insert BLOB?

Re: How to insert BLOB?

From: Ken Wallis <kenws_at_nospam.com>
Date: Fri, 05 Sep 2003 02:31:56 GMT
Message-ID: <3f57f59b@news.comindico.com.au>


> "Amit" <jindal_at_roguewave.com> wrote in message

>> You need to first allocate a OCILobLocator, then bind that and
>> execute the query and then use OCILobWrite. Though it will only work
>> with Oracle 9 onwards.

>> "Ole Hansen" <rm_oha_rm_at_city.dk> wrote in message

>>> Is it possible to insert BLOB data without doing a select first? I >>> have data available and want to insert a row with BLOB data.

If you have a BLOB or CLOB column in an SQL INSERT statement you can set the bind type in your OCIBindBy...() call to SQLT_LNG and simply specify the address and length of the raw data and the OCI will hide all the LobLocator stuff from you - much easier IMHO.

I would never bind a BLOB or CLOB as LONG or LONG RAW for a SELECT because you can get yourself into big trouble with array and piecewise fetching, but for INSERTs it is a real time saver.

This works at 8i (8.1.7) and I assume it will work at 9i, though I haven't yet tested to be sure.

Cheers,

Ken Received on Thu Sep 04 2003 - 21:31:56 CDT

Original text of this message

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