By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,322 Members | 1,182 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,322 IT Pros & Developers. It's quick & easy.

OCI: generic binds

P: n/a
I'm quite new to using OCI and I'm trying to find a way of creating a
function to handle all store procedures in a database, problem I'm
having is with the OCIBindByPos function and how to make the type of
data being returned/input to the stored procedure generic.

I the following set up....

..
..
..
char * arrData[200];
..
..
..

/* get the number of arguments*/
checkerr(errhp, OCIAttrGet((dvoid *) arglist, OCI_DTYPE_PARAM,
(dvoid*)numArgs, (ub4*)0,(ub4)OCI_ATTR_NUM_PARAMS , errhp));

for (i=1; i<=numArgs;i++) {

OCIParamGet (arglist, OCI_DTYPE_PARAM, errhp, &arg, i);

OCIAttrGet ((dvoid *)arg, OCI_DTYPE_PARAM, (dvoid*)&atypecode,
(ub4*)0, OCI_ATTR_DATA_TYPE, errhp);

OCIAttrGet ((dvoid *)arg, OCI_DTYPE_PARAM, (dvoid*)&amaxsize,
(ub4*)0, OCI_ATTR_DATA_SIZE, errhp);

checkerr( errhp, OCIBindByPos(stmthp, (dvoid*)&arrOCIBind[i],
errhp, i, &arrData[i] ,(sword)amaxsize , atypecode , (dvoid *) 0,(ub2
*) 0, (ub2) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT));
}
running my test harness for a stored procedure which takes two params,
a SQLT_INT and SQLT_AFC out I get "OCI_NO_DATA found" from which
suggests to me that data is being druncated.

Can anyone suggest what I need to change? Or is there another way
altogether i should be going about this? any sample code would go down
a treat!!

Thanks,

Andy.
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.