On 25-9-2018 16:49, [email protected] [firebird-support] wrote: > Hello! I use FB 2.5. I know that this its almos imposible, but just in > case I ask. Is there any chance that a trigger is not firing at all?
Have you checked if the trigger is still active, maybe it was disabled? > I have this very simple trigger to create one record for each warehouse > in the "stock" table. But I've found that quite a lot of articles (in > the stock table) doesn't have its records in the "sto_cantidades" table. > > It is possible that some kind of corruption causes that? or should I > chek my entire code and see if that records are somehow being deleted? In the face of bugs or a corrupted database, of course anything is possible, but that should - in most cases - still produce errors. > CREATE OR ALTER trigger stock_ai5 for stock > active after insert position 5 > AS > declare variable loc_id fk_id; > begin > for select id from sto_depositos where activo = 1 into :loc_id do > begin > insert into sto_cantidades (id_stock, id_sto_depositos, cantidad) > values (new.id, :loc_id, 0); > end > end Not related to your problem, but using insert ... select is probably more efficient (and simpler to read in my opinion) -- Mark Rotteveel
