Subject RE: [firebird-support] Re: Triggers suitability
Author Alan McDonald
> Hi Adam,
>
> In the stored procedure,
>
> > BEGIN
> > FOR SELECT ITEM_ID, SUM(QUANTITY)
> > FROM SUMMARYTABLE
> > GROUP BY ITEM_ID
> > INTO :ITEM_ID, :QUANTITY
> > DO
> > BEGIN
> > DELETE FROM SUMMARYTABLE
> > WHERE ITEM_ID = :ITEM_ID;
> >
> > insert into summarytable (item_id, quantity)
> > values (:ITEM_ID, :QUANTITY);
> > END
>
>
> Would there be a problem if after the sp has read the records but
> before the deletion, additional records for the item are inserted
> into the table? How can I ensure that the deletion only applies to
> the records that have been read by the cursor, and not to all
> records? Thanks.
>
> Ray Mond

that's why we have transactions. Records being inserted after the select
won't be visible during this transaction.
Alan