Bug #62662 how to retrieve multiple insert IDs
| Submitted: | 9 Oct 2011 21:27 | Modified: | 26 Dec 2012 8:15 |
|---|---|---|---|
| Reporter: | Don Cohen | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server | Severity: | S4 (Feature request) |
| Version: | OS: | Any | |
| Assigned to: | CPU Architecture: | Any |
[9 Oct 2011 21:27]
Don Cohen
[26 Dec 2012 8:15]
MySQL Verification Team
Hello Don Cohen, >>If that is the case, how can one find out how many inserts the last statement did? >>In any case there ought to be a way to find out, so either tell me how to do so or consider this to be a feature request that such a thing be supplied. You can make use of ROW_COUNT() function which is similar to the value from the mysql_affected_rows() C API function and the row count that the mysql client displays following statement execution. Please see, http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_row-count For example: mysql> INSERT INTO t VALUES(1),(2),(3); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> SELECT ROW_COUNT(); +-------------+ | ROW_COUNT() | +-------------+ | 3 | +-------------+ 1 row in set (0.00 sec)
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.