Jump to content
Henry Olive

Interbase Trigger

Recommended Posts

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

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.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×