Declaration
ROW_COUNT()
Description
Returns the number of rows affected by the executed SQL statement.
ROW_COUNT returns different values depending on the statement:
DDL statements: Return
0.DML statements other than
SELECT: The number of rows affected.Specifically, the
UPDATEstatement returns the number of rows actually affected.SELECT: If the execution result of theSELECTstatement is a set,-1is returned. If theSELECTstatement affects the row status, the number of affected rows is returned.For example, the
SELECT .... INTOstatement returns the number of rows inserted.
Examples
obclient> INSERT INTO t VALUES(1),(2),(3);
Query OK, 3 rows affected (0.02 sec)
Records: 3 Duplicates: 0 Warnings: 0
obclient> SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
| 3 |
+-------------+
1 row in set