Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> help wanted: OCI insert with array of indicator variables

help wanted: OCI insert with array of indicator variables

From: <matt.freestone_at_gmail.com>
Date: 16 Jan 2007 03:57:55 -0800
Message-ID: <1168948675.146914.185260@38g2000cwa.googlegroups.com>


Any help with the following would be greatly appreciated:

I'm trying to insert an array of values into a column using OCI. Some values should be null so I thought I should use indicator variables set to -1 to get nulls inserted for these. In the OCI docs for indicator variables it says, "The implementation of arrays of structures also supports the use of indicator variables and return codes. You can declare parallel arrays of column-level indicator variables and return codes that correspond to the arrays of information being fetched, inserted, or updated. These arrays can have their own skip parameters, which are specified during OCIBindArrayOfStruct() or OCIDefineArrayOfStruct() calls. ... A one-to-one relationship between the fields in an indicator struct and the number of select-list items is not necessary."

Am I right to read that as saying that the indicator is at the column level rather than the field level? If I pass a parallel array of indicators to OCIBindByPos along with my array of column data, and set the indskip parameter of OCIDefineArrayOfStruct to sizeof(sb2) then the indicators that are set to -1 are ignored, and I get garbage data rather than nulls in the fields.

Can I use indicators this way? What am I doing wrong?

thanks,

-- 
Matt Freestone
Received on Tue Jan 16 2007 - 05:57:55 CST

Original text of this message

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