Does anyone have any sample code on how to execute
a package call that returns a cursor. I don't get any
errors and don't get any rows either. Here is the code:
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';
}
row.erase(row.find_last_of
('\t'));
std::cout
<< "=========================="<<row <<
std::endl;
}
}catch( std::exception& ex ){
logError(ex, LOCATION);
}