Garayed.com  

Go Back   Garayed.com > Oracle
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-16-2007, 10:57 AM
matt.freestone@gmail.com
 
Posts: n/a
Default help wanted: OCI insert with array of indicator variables

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-16-2007, 01:57 PM
matt.freestone@gmail.com
 
Posts: n/a
Default Re: help wanted: OCI insert with array of indicator variables


matt.freestone@gmail.com wrote:
<snip>
>
> 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?
>

I've solved my own problem. In case it's relevant to anyone else - you
can use an array of indicators in the way I asked about. I had a dodgy
type conversion that was stopping the values being used correctly.

cheers,
--
Matt Freestone

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:16 AM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.