Subject Re: [firebird-support] Getting number of records affected ...
Author Helen Borrie
At 04:34 AM 17/12/2003 -0800, you wrote:
>I am trying to write a stored procedure that will attempt an
>Update ...
>statement first. Then it should check for the number of records
>affected by
>the Update statement, and if the number of records affected are
>zero, it
>should issue an Insert... statement.
>How do I find out the number of records affected by an action

In Firebird 1.5 you can read the ROW_COUNT variable after an update. But
your strategy here is to do an existence check, which avoids the update
operation altogether if there are no rows to update:

if (exists (select 1 from atable where akey = :akey and ....)) then
update atable set.....;
insert into atable(..........