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 -> How to get REF CUSOR variable using OCI?

How to get REF CUSOR variable using OCI?

From: <victor_at_mx.snet.ru>
Date: Wed, 16 Dec 1998 09:30:12 GMT
Message-ID: <757uj4$15p$1@nnrp1.dejanews.com>


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

Original text of this message

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