Link to home
Start Free TrialLog in
Avatar of Sue Tippett
Sue TippettFlag for United States of America

asked on

Trigger issue Expected ORDER/REFERENCING/FOR/WHEN keywords or a triggered action block

I am new to triggers for Teradata.   from the staging table if the submit quantity changes on records where the type code is either 'stock' or 'ship' update the Inventory table quantity.

This is the message I am getting:
Expected ORDER/REFERENCING/FOR/WHEN keywords or a triggered action block

REPLACE TRIGGER stgInvChng_Trg
AFTER UPDATE OF (SbmtQty) ON stgInvChng
NEW AS after row
FOR EACH ROWWHEN(afterrow.TypeCd IN ('Stock’,'Ship' ))
( Update i
FROM stgInvChng s, Invtry i
 SET InvQty = SbmtQty
Where
New.Itme = s.Item AND
s.Item = i.item);
ASKER CERTIFIED SOLUTION
Avatar of Mark Wills
Mark Wills
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sue Tippett

ASKER

Punctuation was my issue  ););.   Thank you
With all  the scenario I tried prior to posting, Punctuation );); was the real issue.  Plus I didn't need to attempt to filter "FOR EACH  ROW WHEN"
Good to hear.... And very happy you have your solution :)

I do wish we had "FOR EACH ROW" in SQL Server triggers !