SQLRowCount - Get row count

 

SQLRowCount() returns the number of rows in a table affected by an UPDATE, INSERT, or DELETE statement processed against the table, or a view based on the table.

SQLExecute() or SQLExecDirect() must be called before calling this function.

 

Syntax

SQLRETURN SQLRowCount (SQLHSTMT      hstmt,
                       SQLINTEGER    *pcrow);

 

Function arguments

Table 1. SQLRowCount arguments
Data type Argument Use Description
SQLHSTMT hstmt Input Statement handle.
SQLINTEGER * pcrow Output Pointer to location where the number of rows affected is stored.

 

Usage

If the last processed statement referenced by the input statement handle is not an UPDATE, INSERT, or DELETE statement, or if it is not processed successfully, then the function sets the contents of pcrow to 0.

Any rows in other tables that might have been affected by the statement (for example, cascading deletes) are not included in the count.

 

Return codes

 

Diagnostics

Table 2. SQLRowCount SQLSTATEs
SQLSTATE Description Explanation
40003 * Statement completion unknown The communication link between the CLI and the data source fails before the function completes processing.
58004 System error Unrecoverable system error.
HY001 Memory allocation failure The driver is unable to allocate memory required to support the processing or completion of the function.
HY009 Argument value that is not valid pcrow is a null pointer.
HY010 Function sequence error The function is called before calling SQLExecute or SQLExecDirect for the hstmt.
HY013 * Memory management problem The driver is unable to access memory required to support the processing or completion of the function.

 

References

 

Parent topic:

DB2 UDB CLI functions