8. SQL Statements : SET : Update_Rowcount
 
Share this page                  
Update_Rowcount
The SET UPDATE_ROWCOUNT statement specifies the nature of the value returned by the INQUIRE_SQL(ROWCOUNT) statement.
Valid options are:
CHANGED
Returns the number of rows changed by the last query.
QUALIFIED
(Default) Returns the number of rows that qualified for change by the last query.
For example, consider the following table called test_table:
column1
column2
column3
Jones
000
green
Smith
000
green
Smith
000
green
and the following query is executed:
UPDATE test_table SET column1 = 'Jones'
        WHERE column2 = 000 AND column3 = 'green';
The DBMS Server, for reasons of efficiency, does not actually update the first row because column1 already contains "Jones". However, the row does qualify for updating by the query.
If the UPDATE_ROWCOUNT option is set to CHANGED, INQUIRE_SQL(ROWCOUNT) returns 2 (the number of rows actually changed).
If the UPDATE_ROWCOUNT option is set to QUALIFIED, INQUIRE_SQL(ROWCOUNT) returns 3 (the number of rows that qualified to be changed).
To determine the setting for the UPDATE_ROWCOUNT option, issue the following statement:
SELECT DBMSINFO('UPDATE_ROWCNT')