tags:

views:

621

answers:

2

I have an ORACLE update statement that I call using the OCIStmtExecute function call.

Using an OCI function call I would like to know how many rows have been updated by the action, e.g. zero, one or more.

How do I do this ?

+1  A: 

Invoke OCIAttrGet(OCI_ATTR_ROW_COUNT) on the statement handle.

Quassnoi
Thanks Quassnoi I'd just worked it out too myself and have posted an answer as well. Thanks for looking at it.
David
+1  A: 

Use the OCIAttrGet function call on your OCIStmt statement handle with the attribute type set to OCI_ATTR_ROW_COUNT

So add the folllowing code to your program :

   ub4 row_count;

   rc = OCIAttrGet ( stmthp, OCI_HTYPE_STMT, &row_count, 0, OCI_ATTR_ROW_COUNT,
           errhp );

where:

stmthp is the OCIStmt statement handle

errhp is the OCIError error handle

rc is the defined return code (sword)

The number of rows updated (or deleted and inserted if that is your operation) is written into the passed row_count variable

David