Subject Re: [firebird-support] DML in triggers
Author Svein Erling Tysvaer
Leyne, Sean wrote:
> Chris,
>
>> I had a Before Update trigger that included a statement like:
>> delete from ATable where SomeField=Somevalue
>> embedded in a trigger on ATable. This was causing the database to be
>> corrupted. In other tables, I'ved used triggers to update other tables
>> with
>> great success. I need to re-create the delete functionality described
>> above,
>> and I can do it at the application level, but I would prefer that the
>> function is part of the database logic (i.e. application-independent).
>> Is this possible, and if so, how can I implement it?
>
> Nothing you should do in the database should cause a corruption, so the
> details for this issue are important
>
> Please confirm the FB version/platforms you are running.
>
> Please post the code to the problematic trigger.
>
> Sean

I agree with Sean, although I'd moderate myself to say nothing except
some hardware fault or home made UDFs should cause corruption.

In general, I'd say that updating anything but the current row should be
done in AFTER triggers and not BEFORE triggers, but even if doing this
do solve your particular problem, please try to make a reproducible test
case that shows the error you experience.

HTH,
Set