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 -> Problem with OCI on Oracle 8.1.5 with binding PL/SQL cursors to a OCIStmt handle

Problem with OCI on Oracle 8.1.5 with binding PL/SQL cursors to a OCIStmt handle

From: Kræn David Christensen <kdc_at_stibo.dk>
Date: Fri, 4 Feb 2000 09:54:24 +0100
Message-ID: <949654232.316067@radon.stibo.dk>


Hi,

I have a problem with OCI on Oracle 8.1.5 (on SUN Solaris platform). When binding a PL/SQL cursor to a statement I get:

  "ORA-03106: fatal two-task communication protocol error"

My code is like this:

  _myenvhp, _myerrhp, _mysvchp are allocated and initialized correctly elsewhere in the code.

  string sql = "begin open :refcur for select id from test order by id; end;";

  OCIStmt* sqlstmt=0;
  OCIStmt* cursorstmt=0;
  OCIBind* curbind=0;

  checkError(OCIHandleAlloc((dvoid *)_myenvhp,
       (dvoid **)&sqlstmt,
       (ub4) OCI_HTYPE_STMT, (size_t)0, (dvoid **)0),
      "Unable to alloc statement handle for plsql fetch",PIIEXCSQL);
  checkError(OCIHandleAlloc((dvoid *)_myenvhp,
         (dvoid **)&cursorstmt,
       (ub4) OCI_HTYPE_STMT, (size_t)0, (dvoid **)0),
      "Unable to alloc statement handle for plsql fetch",PIIEXCSQL);
  checkError(OCIStmtPrepare(sqlstmt, _myerrhp, (text*)sql.c_str(), sql.size(),
       OCI_NTV_SYNTAX, OCI_DEFAULT),
      "Unable to prepare statement", PIIEXCSQL);
  checkError(OCIBindByName(sqlstmt, (OCIBind**)&curbind, _myerrhp,
      (text*) ":refcur", (sb4)strlen(":refcur"),
      (dvoid*)&cursorstmt,
      (sb4)0, SQLT_RSET, (dvoid*)0, (ub2*)0,
      (ub2*)0, (ub4)0, (ub4*)0, OCI_DEFAULT),
      "Bind variable cursor failed", PIIEXCSQL);

  sword ociret=0;
  ociret = OCIStmtExecute(_mysvchp, sqlstmt, _myerrhp, 1, 0,

         (OCISnapshot *) NULL, (OCISnapshot *) NULL,
         (ub4) OCI_DEFAULT);

  checkError(ociret, "Execute of var. cursor", PIIEXCSQL);

>>>> Even before getting to fetching from statement handle 2 I get the "ORA
03196"!!!! The error comes aftyer the above execute!!

Any ideas? What do I do wrong (or does OCI not work proberly). I copied the exampel right of the text book Oracle Call Interface volume release 8.1.5 volume 1 page 5-30.
All other things works fine (tested array fetch, normal execute of PL/SQL block, etc.).

Regards, Kræn Received on Fri Feb 04 2000 - 02:54:24 CST

Original text of this message

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