Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> How to get REF CUSOR variable using OCI?
Hi ! I get difficulties in getting result set (from stored procedure REF
CURSOR in out parameter) with OCI on NT platform. Method described in
"Programmer's Guide to the Oracle Call Interface" doesn't work. I've tried to
use code like this:
//----------------------------------------------------------------------
char * sSQL = "BEGIN open :cur for select * from tab; END;";
OCIStmtPrepare(stmthp, parent->errhp, (text *) sSQL, (ub4) strlen(sSQL),
OCI_NTV_SYNTAX, OCI_DEFAULT);
OCIStmt * stmt1hp;
OCIBind *pBindHP = 0;
char *tmp;
sword status;
int indicator;
OCIHandleAlloc((dvoid *) parent->envhp, (dvoid **) &stmt1hp, OCI_HTYPE_STMT, 1, (dvoid **) &tmp);
// Without this alloc it crashed on OCIExewute OCIHandleAlloc( stmthp,(void ** ) &pBindHP,OCI_HTYPE_BIND,1,(void ** ) &tmp);
status = OCIStmtBindByPos(stmthp,pBindHP,parent->errhp, 1, @stmt1hp,4, iOraType, indicator, (ub2 *) 0, (ub2*) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT);
status = OCIStmtExecute(svchp, stmthp, parent->errhp, 1, 0, 0,
0,OCI_DEFAULT); //Here I get status == -1 with error code 24358 and message
"ORA-00000: normal, successful completion" :(((
status = OCIStmtFetch(stmt1hp,parent->errhp,1,OCI_FETCH_NEXT,OCI_DEFAULT); // status == -2 :(
//------------------------------------------------------------------What I did wrong?
If you have any experience in this, please give me advice.
Thanks,
Victor Stolbovoy
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Wed Dec 16 1998 - 03:30:12 CST