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 -> Binding arrays with OCI

Binding arrays with OCI

From: Herode <cbrun_at_geomapgis.com>
Date: 16 Mar 2006 09:11:29 -0800
Message-ID: <1142529089.380390.226680@i39g2000cwa.googlegroups.com>


Gentlemen,

I'm trying to bind a simple array of integers before an INSERT statement. I guess something in the documentation escaped my attention, because I'm unable to make the bind. For exemple, on the following code, I get an ORA-01485 error (traduced from french : the length of bind at compile time is not the same than at execution time).
[code]
[...]

  int linkedInts[] = { 33,34,35 };
  ub2 eltSizes[3];
  eltSizes[ 0 ] = eltSizes[ 1 ] = eltSizes[ 2 ] = sizeof( int );   ub4 count = 3;
  //sb2 indicator[ 2 ];
  OCIBind* pBindh;
  char* name = ":col1";
  st = ::OCIBindByName( m_pStmt, &pBindh, m_pErr,

                        reinterpret_cast< text* >( name ), strlen( name
),
                        &linkedInts, sizeof( int ), SQLT_INT,
                        NULL, eltSizes, NULL,
                        0, &count, OCI_DEFAULT );
  if ( st != OCI_SUCCESS && st != OCI_SUCCESS_WITH_INFO ) {     CString ret = GetErrorText( m_pErr );     cout << ret.GetBuffer( 0 ) << endl;
    return false;
  }
[...]
[/code]

I'm stuck. Any help will be appreciated ! Received on Thu Mar 16 2006 - 11:11:29 CST

Original text of this message

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