OCI array of strings bind

OCI array of strings bind

Post by Simeon Baile » Wed, 31 Mar 1999 04:00:00



Hi,
    I'm attempting to bind an array of strings of variable length.

text *textval = "Entry1Entry2"
ub2 alen[2];
alen[0] = 6;
alen[1] = 6;

status = OCIBindByPos (stmtp, &bindpp, errpp, 1, textval, 6,
    SQL_CHR, inds, alen, 0, 0, 0, OCI_DEFAULT);

This works fine, however when I try to insert two strings of different
lengths things go awry.

Is it possible bind an array of variable length strings, or do they have
to fixed length padded with spaces?

Thanks S.

 
 
 

OCI array of strings bind

Post by <j.m.s.. » Wed, 31 Mar 1999 04:00:00


You forgot to BindArrayOfStruct(6,0,0,0) after your BindByPos

The 'ALen' parameter lets you specify the Actual LENgth of your parameter.
The array itself must have a fixed 'skip size', as specified by
BindArrayOfStruct.

In short, you do not need to pad spaces, but use the Alen parameter.

JM


>Hi,
>    I'm attempting to bind an array of strings of variable length.

>text *textval = "Entry1Entry2"
>ub2 alen[2];
>alen[0] = 6;
>alen[1] = 6;

>status = OCIBindByPos (stmtp, &bindpp, errpp, 1, textval, 6,
>    SQL_CHR, inds, alen, 0, 0, 0, OCI_DEFAULT);

>This works fine, however when I try to insert two strings of different
>lengths things go awry.

>Is it possible bind an array of variable length strings, or do they have
>to fixed length padded with spaces?

>Thanks S.


 
 
 

1. Bind an array with OCI

Hi,

I'm trying to bind an array to a placeholder in a simple OCI query like:

"select * from foo where bar in :ph"

I want to bind ':ph' to a memory array filled with values of bar I need to
get.
I try without success to use obndra, and get an ORA-01414 error (Invalid
array length when trying to bind array).

Does anyone know if it is possible to make this without use PL/Sql ?

Any info about this would be greatly appreciated.

Eric.

2. US-CO.-DBA

3. Binding OCI Arrays

4. pgsql/contrib/dbmirror

5. BIZARRE problem with OCI array bind, insert

6. Cannot connect to an Access DSN using ODBC!

7. OCI Array Binds

8. Primary Domain Server

9. Binding and Defining arrays of structures with OCI 8.0

10. OCI Array Binds

11. OCI Binding array of rowtype

12. OCI: binding arrays in select statements?

13. OCI and binding arrays