Processing UPDATE, DELETE, and INSERT statements in a DB2 UDB CLI application
If the statement modifies data (UPDATE, DELETE, or INSERT), no action is required other than the normal check for diagnostic messages. In this case, SQLRowCount() can be used to obtain the number of rows affected by the SQL statement.
If the SQL statement is a Positioned UPDATE or DELETE, it is necessary to use a cursor. A cursor is a moveable pointer to a row in the result table of a SELECT statement. In embedded SQL, cursors are used to retrieve, update or delete rows. When using DB2® UDB CLI, it is not necessary to define a cursor, because one is generated automatically.
In the case of Positioned UPDATE or DELETE statements, specify the name of the cursor within the SQL statement. You can either define your own cursor name using SQLSetCursorName(), or query the name of the generated cursor using SQLGetCursorName(). It is best to use the generated name, because all error messages refer to this name, and not the one defined by SQLSetCursorName().
Parent topic:
Processing results in a DB2 UDB CLI application
Related reference
SQLNumResultCols - Get number of result columns