Subject Re: [firebird-support] Getting number of records affected ...
Author Dimitry Sibiryakov
On 17 Dec 2003 at 4:34, Anand wrote:

>How do I find out the number of records affected by an action
>query?

Besides other suggestions, I must tell you another variant by
Dmitri Popov:

DECLARE VARIABLE MY_PK_VALUE INTEGER;
.............
MY_PK_VALUE = NULL;
FOR SELECT PK FROM MY_TABLE WHERE ....
INTO :MY_PK_VALUE AS CURSOR TMPCURSOR
DO
UPDATE MY_TABLE SET ... WHERE CURRENT OF TMPCURSOR;

IF (MY_PK_VALUE IS NULL) THEN
INSERT INTO MY_TABLE .....
...........

This variant has proved itself as the fastest.

SY, Dimitry Sibiryakov.