Subject | Re: [firebird-support] Getting number of records affected ... |
---|---|
Author | Helen Borrie |
Post date | 2003-12-17T13:03:02Z |
At 04:34 AM 17/12/2003 -0800, you wrote:
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.....;
else
insert into atable(..........
heLen
>I am trying to write a stored procedure that will attempt anIn Firebird 1.5 you can read the ROW_COUNT variable after an update. But
>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
>query?
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.....;
else
insert into atable(..........
heLen