Syntax
ROW_COUNT()
Purpose
Returns the number of rows affected by the executed SQL statement.
The ROW_COUNT function returns different values based on the type of statement:
DDL statements: returns
0.DML statements other than
SELECT: returns the number of rows affected.Specifically, the
UPDATEstatement returns the actual number of rows affected.SELECTstatements: returns-1if the execution result is a set, and returns the number of rows affected if theSELECTstatement affects the row status.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
