I have tried per the code below. No errors, but no rows either. Does OCI support packages? Is it coded properly?
std::string f1,f2,fromDate,toDate,status; ostringstream query;
try{ ///* get data query << " begin SCHEMA1.PACKAGE1.getInfo(:f1, :f2, :f3, :fromDate, :toDate, :status, :results );"; query << " end;";
OCICPP::Cursor cur; OCICPP::Cursor results; conn.prepare( query.str(), cur );
cur.bind( ":f1", f1); cur.bind( ":f2", f2); cur.bind( ":f3", f3); cur.bind( ":fromDate", fromDate ); cur.bind( ":toDate", toDate ); cur.bind( ":status", status ); cur.bind( ":results", results ); cur.execute(); results.execute();
string column; string row; // output each row while( results.fetch() ) { row = "";
for( int i = 0; i < results.getNCols(); i++ ) { results.getStr( i, column ); row += column + '\t'; } std::cout << "=========================="< std::endl; }
}catch( std::exception& ex ){ logError(ex, LOCATION); }
Log in to post a comment.
I have tried per the code below. No errors, but no rows either. Does OCI support packages? Is it coded properly?
std::string f1,f2,fromDate,toDate,status;
ostringstream query;
try{ ///* get data
query << " begin SCHEMA1.PACKAGE1.getInfo(:f1, :f2, :f3, :fromDate, :toDate, :status, :results );";
query << " end;";
OCICPP::Cursor cur;
OCICPP::Cursor results;
conn.prepare( query.str(), cur );
cur.bind( ":f1", f1);
cur.bind( ":f2", f2);
cur.bind( ":f3", f3);
cur.bind( ":fromDate", fromDate );
cur.bind( ":toDate", toDate );
cur.bind( ":status", status );
cur.bind( ":results", results );
cur.execute();
results.execute();
string column;
string row;
// output each row
while( results.fetch() )
{
row = "";
for( int i = 0; i < results.getNCols(); i++ )
{
results.getStr( i, column );
row += column + '\t';
}
std::cout << "=========================="< std::endl;
}
}catch( std::exception& ex ){
logError(ex, LOCATION);
}