> create procedure delete_my_stuff as
> declare variable stf_transno BigInt = 0; -- or integer, or whatever it is
> declare variable is_present smallint;
> begin
> for select transno from ST_TR_FIFO
> for update
> into :stf_transno
> as cursor acursor do
> begin
> is_present = 0;
> if (exists (select 1 from ST_TR
> where TRANSNO = :stf_transno)) then
> is_present = 1;
> if (is_present = 0) then
> delete from ST_TR_FIFO
> where current of acursor;
> end
> end
>
> NB The above (original) syntax works in all Fb versions. In v.2 and above, there's an enhanced cursor syntax that also supports positioned deletes and updates.
Thank you for your reply. However, it doesn't run as fast as I think. In fact, the same data and size of tables running in MSSQL 2005 takes less than 5 seconds only.