Forum Stats

  • 3,854,668 Users
  • 2,264,397 Discussions
  • 7,905,749 Comments

Discussions

when call procedure having sys_refcursor, registerOutParam ora-01008 occured

user5938130
user5938130 Member Posts: 1
edited Aug 18, 2015 2:43AM in Oracle Call Interface (OCI)

c++ / oracle base.

create procedure and c++ application through occi interface.

for detail following.

  ---------------------------------------------------------------------------

CREATE OR REPLACE PROCEDURE SP_ENGINEERING_DATA_REQ(
                                           P_SQL IN VARCHAR2,
                                          P_CUR OUT SYS_REFCURSOR)
IS

BEGIN
    OPEN p_cur FOR p_sql;
END;
/

---------------------------------------------------------------------------

when C++ source call execute() , ORA-01008 occured...

(ORA-01008: Not all variables bound.)

---------------------------------------------------------------------------


int Database::sp_dbm_odb_engineering_data_req(ENGINEERING_DATA_REQ_T* pReq, unsigned int lenReqData)
{
Statement *stmt = NULL;
ResultSet *rs = NULL;

ENGINEERING_DATA_REQ_T reqStruct;
reqStruct.Deserialize((unsigned char*)pReq);

cout << "AdhocQuery:" << reqStruct.AdhocQuery << endl;

try

  stmt = con->createStatement();
  stmt->setSQL("begin sp_engineering_data_req(:1, :2);end;");
  stmt->setString(1, "SELECT SEQNO, DATADT FROM PAMINFO");
  stmt->registerOutParam(2, OCCICURSOR);
 

  if(stmt)
  {
   try
   {
    int nResult = stmt->execute(); //here ORA-01008 !!!

    rs = (ResultSet*)stmt->getObject(2);
    while(rs->next())
    {
     int seq = rs->getInt(1);
     string strDate = rs->getString(2);

     cout << "seq:" << seq << " date" << strDate << endl;
    }
   }
   catch (SQLException& ex)
   {
    cout << ex.getMessage();
   }  

  }

  con->terminateStatement(stmt);
}
catch (SQLException& ex)
{
  cout << ex.getMessage();
}

return 0;
}

---------------------------------------------------------------------------

maybe, I am missing... I don't know how solve the problem.


Thanks in advance.

This discussion has been closed.