Henry Olive 5 Posted September 13, 2021 I wish everyone a healthy day. I have below INTERBASE Trigger. Eventhough i had no problem creating the trigger it doesnt work as expected ( I fill RESERVQTY ( value=2) when running the program by myself, after post when i check RESERVQTY's value in the Database i see the value =2 but trigger Doesnt write ITEMS table's ORDRESERVE field anything, Should have been 2 ) What am i doing wrong ? Thank You CREATE TRIGGER "ORDETRESERVE_INS" FOR "ORDETAIL" ACTIVE AFTER INSERT POSITION 0 AS begin IF (New.RESERVQTY > 0) THEN UPDATE ITEMS SET ORDRESERVE = (COALESCE(ORDRESERVE,0) + New.RESERVQTY) WHERE ITEMNO = New.ITEMNO; end; Share this post Link to post
corneliusdavid 214 Posted September 14, 2021 Can you show the table structure or at least the INSERT statement that would trigger this? I suspect it might have to do with New.ITEMNO as that's filtering out the records for which the UPDATE statement would work with. 1 Share this post Link to post
skyzoframe[hun] 4 Posted September 14, 2021 (edited) 18 hours ago, Henry Olive said: AFTER INSERT Change after insert to before insert. https://docwiki.embarcadero.com/InterBase/2020/en/The_Trigger_Body Edited September 14, 2021 by skyzoframe[hun] 1 Share this post Link to post
Henry Olive 5 Posted September 14, 2021 Thank you so much CorneliusDavid, SkyzoFrame Share this post Link to post