PDA

View Full Version : How to insert BLOB?


Ken Wallis
09-04-2003, 06:31 PM
> "Amit" <jindal@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@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


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service