AIX OCCI executeArrayUpdate ORA-32109 exception [message #233138] |
Wed, 25 April 2007 00:04 |
lls_study
Messages: 3 Registered: January 2006
|
Junior Member |
|
|
Using Oracle9i OCCI on AIX xxx 2 5 00C5301D4C00,
executeArrayUpdate() method throws exception:
ORA-32109: invalid column or parameter position.
On other platform,Linux SunOs HP Window ,
executeArraryUpdate() is ok.
Why?
Thanks
Compiler Command:
xlC_r -o occitest -g -I/oracle/app/oracle/product/9.2.0/include -I/oracle/app/oracle/product/9.2.0/rdbms/public
-I/oracle/app/oracle/product/9.2.0/rdbms/demo -I/oracle/app/oracle/product/9.2.0/plsql/public
-I/oracle/app/oracle/product/9.2.0/network/public -L/oracle/app/oracle/product/9.2.0/lib
-q64 -qthreaded -qstaticinline -bhalt:5 -lpthread -lnsl -locci -lm -lclntsh OcciTest.cpp
Code:
/********************************************/
/********************************************/
#include <iostream>
#include <occi.h>
using namespace std;
using namespace oracle::occi;
//executeArrayUpdate size
const int ARRAY_SIZE = 2;
int main()
{
Environment *pEnv = NULL;
Connection *pCon = NULL;
Statement *pStmt = NULL;
try
{
//Connect
pEnv = Environment::createEnvironment (Environment::THREADED_MUTEXED);
pCon = pEnv->createConnection("xxx", "xxx", "xxx");
pStmt = pCon->createStatement("insert into social_id(id) values (:v1)");
}
catch(SQLException &ex)
{
cout<<"Error number: "<< ex.getErrorCode() << endl;
cout<<ex.getMessage() << endl;
return -1;
}
long *pServID = new long[ARRAY_SIZE];
ub2 *pLen = new ub2 [ARRAY_SIZE];
int nRowNum = 0;
long fL = 1;
long ffL = 1;
for(int i = 0; i < 16; ++i)
{
pServID[nRowNum] =fL+ ffL;
fL = ffL;
ffL = pServID[nRowNum] ;
pLen[nRowNum] = sizeof(pServID[nRowNum]);
++nRowNum;
if( (nRowNum % ARRAY_SIZE) == 0)
{
try
{
//Bind
pStmt->setDataBuffer(1,pServID, OCCIINT, sizeof(pServID[0]), pLen);
//Execute Array Update. AIX Throw Exception:ORA-32109: invalid column or parameter position
pStmt->executeArrayUpdate(nRowNum);
pCon->commit();
}
///Handle Exception
catch(SQLException &ex)
{
cout<<"Error number: "<< ex.getErrorCode() << endl;
cout<<ex.getMessage() << endl;
///Free Resource
return -1;
}
nRowNum = 0;
}
}
///
if(nRowNum > 0)
{
try
{
pStmt->setDataBuffer(1,pServID, OCCIINT, sizeof(pServID[0]), pLen);
int outLen = 0;
pStmt->executeArrayUpdate(nRowNum);
pCon->commit();
}
catch(SQLException &ex)
{
cout<<"Error number: "<< ex.getErrorCode() << endl;
cout<<ex.getMessage() << endl;
///Free Resource
return -1;
}
}
delete[] pServID;
pServID = NULL;
delete[] pLen;
pLen = NULL;
pCon->terminateStatement(pStmt);
pEnv->terminateConnection(pCon);
Environment::terminateEnvironment (pEnv);
return 0;
}
/********************************************
*********************************************/
|
|
|
|