Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

occi::setVector giving memory crash error

95042e8a-4177-435b-9291-224d0b00fd8cDec 10 2015 — edited Dec 10 2015

@

HELLO,

I am facing an issue while executing a stored procedure using OCCI and OTT in C++.

My INPUT for the program is a list of strings and their indexes.

My Output for the program is the REFCURSOR.

For the program i wrote, while compiling there was no error but while debugging it, it gave memory crash issues.

i refered some oracle groups posts and checked back again but no replies over there.

PLEASE LET ME KNOW THE SOLUTION FOR THIS OCCI/OTT ISSUE

ORACLE PROCEDURE ---- WORKING PROPERLY (RETURNS THE OUTPUT)

SET serveroutput ON

VARIABLE outpartslist REFCURSOR;

DECLARE

  in_part_list T_TBL_PART_LIST := T_TBL_PART_LIST (T_OBJ_PART_LIST('0944', 1), T_OBJ_PART_LIST('1124', 2), T_OBJ_PART_LIST('1124', 3), T_OBJ_PART_LIST('0944', 4));

BEGIN

  DTC_GETTER_PKG.GET_PART_DATA(:outpartslist , in_part_list );

END;

/

PRINT :OUTPARTSLIST;

TO USE THE ABOVE PROCEDURE USING C++ OCCI PROGRAM

Below is the program i wrote:

extern void main( char argc, char *argv[] )

{

  Environment *env;

  Connection *conn;

  Statement *stmt;

  env = Environment::createEnvironment (Environment::Mode(Environment::OBJECT | Environment::THREADED_MUTEXED));//oracle::occi::Environment::DEFAULT);

  conn = env->createConnection (strUser, strPass, ConnectString);

  int nRowCount=0;

  for (int i = 0; i < 3; i++)

  {

  T_OBJ_PART_LIST *Obj_Part =  new T_OBJ_PART_LIST();

  oracle::occi::Number nNumber = oracle::occi::Number(i+1);

  (Obj_Part->PART_NUM).append("3030200-7");

  Obj_Part->ORDR_NUM = nNumber;

  cout<<Obj_Part->PART_NUM<<"\t";

  cout<< nNumber.operator int()<<"\n";

  spPartslist.push_back(Obj_Part);

  delete Obj_Part;

  }

  cout << "\ncallproc - invoking a PL/SQL procedure with parameters"  << endl;

  stmt = conn->createStatement("BEGIN dtc_getter_pkg.get_part_data(:1, :2); END;");

  stmt->registerOutParam(1, oracle::occi::OCCICURSOR);

  cout << "\nExecuting the block :" << stmt->getSQL() << endl;

  OCCI_STD_NAMESPACE::string strType("T_OBJ_PART_LIST");

  setVector(stmt, 2, spPartslist, "dtc_user" , strType);                      ///          THIS IS WHERE CRASH IS HAPPENING.............

  stmt->execute();

  conn->terminateStatement (stmt);

  cout << "\nocciproc - done" << endl;

  // delete allocated memory

  for (int i=0; i<strDBPartNos.size(); i++)

  {  

  delete spPartslist[i];

  }

conn->terminateStatement(stmt);

env->terminateConnection(conn);

Environment::terminateEnvironment(env);

}

@http://stackoverflow.com/questions/22838205/how-to-call-a-stored-procedure-with-a-parameter-of-type-table

Comments

User_MNIS8

Same issue here.

user9027635

Did you solve the issue?

User_MNIS8

The issue, that came up suddenly at our site, disappeared by itself when we restarted the server and agent. So my recommendation is to try to turn off and on again.

User_SYA4J

Im getting same error message at this date. Any solutions?

1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 7 2016
Added on Dec 10 2015
0 comments
818 views