c++coracle-databaseodpi-c

How do I get count of rows from Oracle SELECT


I can't find proper way to get count of rows returned after successful execution of SELECT statement via ODPI-C.

Hope you can help me.

EDITED: There is a function

int dpiStmt_getRowCount(dpiStmt *stmt, uint64_t *count)

but it only returns the number of rows affected by the last DML statement that was executed or the number of rows currently fetched from a query.


Solution

  • This is not ODPI-C specific. Oracle Database doesn't provide this automatically on SELECT statements. You have to fetch the rows and then count them. Or run 'SELECT COUNT'.