简体   繁体   中英

Oracle OCCI 'select count(*)' result fetching

How can I get there results of the query execution - select count (*) from myTable ? The code is:

... 
oc::Statement* stmt = 
    m_cConnection->createStatement(select count (*) from myTable);

oc::ResultSet* res = stmt->executeQuery();
...

How can I get the value of the row count in res ?

Just write

cout << res->getString(1) << endl;

or

cout << "\t... MySQL counts: " << res->getInt(1) << endl;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM