Versions available for this page: CUBRID 8.3.0 | CUBRID 8.3.1 | CUBRID 8.4.0 | CUBRID 8.4.1 | CUBRID 8.4.3 | CUBRID 9.0.0 |
The ROW_COUNT function returns the number of rows updated (UPDATE, INSERT, DELETE) by the previous statement. Note that the ROW_COUNT function execution area at the SQL level is limited to the client session in which the SQL was created. If this function is called after executing SQL with the ;run or ;xrun command, it returns -1.
ROW_COUNT()
SELECT * FROM info_tbl;
=== <Result of SELECT Command in Line 1> ===
id name
===================================
1 'a'
2 'b'
NULL 'c'
INSERT INTO info_tbl VALUES (4,'d'),(5, 'e');
SELECT ROW_COUNT();
;xr
=== <Result of SELECT Command in Line 2> ===
row_count()
===============
2
DELETE FROM info_tbl WHERE id IN (4,5);
SELECT ROW_COUNT();
;xr
=== <Result of SELECT Command in Line 2> ===
row_count()
===============
2
SELECT ROW_COUNT();
=== <Result of SELECT Command in Line 1> ===
row_count()
===============
-1