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 -> Oracle 8.1 OCI array inserts of strings

Oracle 8.1 OCI array inserts of strings

From: Arien Malec <amalec_at_slip.net>
Date: Fri, 20 Aug 1999 21:45:35 -0700
Message-ID: <37BE2EEF.DE4B45EA@slip.net>


What is the correct way to do array inserts of strings?

I've been going mad trying different combinations, and I'm sure I'm missing something obvious. Unfortunately, the docs don't have any examples of array inserts...

What I've been trying to do can be summarized like this:

  char * messages[2] = {"Hello, world","The British are coming" };   int mlena[2] = {strlen(messages[0]), strlen(messages[1])};

  /*...*/

  status = OCIBindByName (stmhp,

(OCIBind **) &bnd2hp,

     errhp,

(text *) ":MESSAGE",
strlen (":MESSAGE"),
(ub1 *) *messages,
(sword) 30,
SQLT_CHR,
(dvoid *) 0,
(ub2 *) mlena,
(ub2 *) 0,
(ub4) 0,
(ub4 *) 0,
OCI_DEFAULT);

If I pass the array parameter without dereferencing it, I get total garbage in the message column. When I dereference it, I get the first message in the database, but nothing for the second. I was able to pass an array of ints, with no problem (and I didn't have to dereference that array).

So what am I missing here?

Thanks Received on Fri Aug 20 1999 - 23:45:35 CDT

Original text of this message

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