On Mon, 2007-01-15 at 13:06 +1100, Bojan Smojver wrote: > So, one doesn't even need the LOB descriptor or anything, let alone > the name of the table or column. Did I miss something important here? > It looks pretty straightforward to me...
Well, I'm facing some major grief regarding this. I found another example, which would suggest more or less the same thing here, but using SQLT_CHR type: http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14249/adlob_data_interface.htm The text and code is: ---------------------------------- Binding LONG Data for LOB Columns in Binds Greater Than 4000 Bytes The following example illustrates binding character data for a LOB column: void simple_insert() { word buflen; text buf[5000]; text *insstmt = (text *) "INSERT INTO Print_media(Product_id, Ad_id,\ Ad_sourcetext) VALUES (2004, 1, :SRCTXT)"; OCIStmtPrepare(stmthp, errhp, insstmt, (ub4)strlen((char *)insstmt), (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT); OCIBindByName(stmthp, &bndhp[0], errhp, (text *) ":SRCTXT", (sb4) strlen((char *) ":SRCTXT"), (dvoid *) buf, (sb4) sizeof(buf), SQLT_CHR, (dvoid *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, (ub4) OCI_DEFAULT); memset((void *)buf, (int)'A', (size_t)5000); OCIStmtExecute(svchp, stmthp, errhp, (ub4) 1, (ub4) 0, (const OCISnapshot*) 0, (OCISnapshot*) 0, (ub4) OCI_DEFAULT); } ---------------------------------- Looks pretty simple, doesn't it? Well, I tried with Oracle XE 10.2.0.1 client and Instant Client 10.2.0.3, all connecting to Oracle XE Server (Universal and not) 10.2.0.3 on Linux - no go. I get: ---------------------------------- Execute error -1: ORA-01461: can bind a LONG value only for insert into a LONG column ---------------------------------- Values up to and including 4000 bytes work fine (minus the character conversion bit, which I still need to figure out). The error appears with 4001+ bytes. Now, the strange thing is that the size of BLOB and CLOB in my table is reported as 4000 bytes. Aren't these things supposed to hold at least gigabytes? Any suggestions welcome... -- Bojan
