ROW_COUNT is incremented by 1 all subsequent UPDATE statements that are executed within cursor and actually can affect only 1 record -------------------------------------------------------------------------------------------------------------------------------------
Key: CORE-5803 URL: http://tracker.firebirdsql.org/browse/CORE-5803 Project: Firebird Core Issue Type: Bug Components: Engine Affects Versions: 3.0.3, 2.5.8, 4.0 Alpha 1 Reporter: Pavel Zotov Run following script: === recreate table test ( id int, val int ); commit; insert into test(id, val) values (1, 10); commit; set term ^; execute block as declare curVal integer; declare curID integer; begin for select id, val from test where id = 1 into curid, curval as cursor cur1 do begin update test set val=123 where current of cur1; rdb$set_context('USER_SESSION','EXE_BLOCK_UPDATE_1_ROW_COUNT', row_count ); update test set val=456 where current of cur1; rdb$set_context('USER_SESSION','EXE_BLOCK_UPDATE_2_ROW_COUNT', row_count ); update test set val=789 where current of cur1; rdb$set_context('USER_SESSION','EXE_BLOCK_UPDATE_3_ROW_COUNT', row_count ); end end ^ set term ;^ set list on; select mon$variable_name as ctx_var, mon$variable_value as ctx_value from mon$context_variables; quit; === Its output will be: === CTX_VAR EXE_BLOCK_UPDATE_1_ROW_COUNT CTX_VALUE 1 CTX_VAR EXE_BLOCK_UPDATE_2_ROW_COUNT CTX_VALUE 2 CTX_VAR EXE_BLOCK_UPDATE_3_ROW_COUNT CTX_VALUE 3 === Value of ROW_COUNT was incremented by 1 all subsequent UPDATE statements that was executed within cursor ("where current of cursor cur1"). -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel