MySQL Forums
Forum List  »  Newbie

Error 1064 in Creating a Trigger
Posted by: Maita Reyes
Date: January 09, 2024 08:50PM

I have 2 tables. PurchaseOrder that records all the sale transaction and Products that contains all products and stock. I want to create a trigger to decrease the stock in Products after inserting a sale in PurchaseOrder. Here is my trigger that gets an error. Please help me! Qty is the column of ordered quantity in table PurchaseOrder. Both table has Product_Id field.


create trigger updateStock
after insert on KS_PurchaseOrders
for each row
begin
update KS_Products set Product_StockLevel= Product_StockLevel - new.Qty
where Product_Id =new.Product_Id
end

Options: ReplyQuote


Subject
Written By
Posted
Error 1064 in Creating a Trigger
January 09, 2024 08:50PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.