Hi! I'm new in using Trigger for my database. I am currently using MySQL 5.0 Query Browser and i would like to create trigger within the browser. Here's my code
Actually I want to check if the OrderID to be inserted is already in the Delivery table, then that insertion is to ba aborted, if not, it will just continue with the insertion.Code:CREATE TRIGGER check_OrderID BEFORE INSERT ON DELIVERY FOR EACH ROW BEGIN IF(orderID!=NEW.OrderID) THEN INSERT INTO DELIVERY(DeliveryID,OrderID,DriverID,DeliveryVID) VALUES(NEW.DeliveryID,NEW.OrderID,NEW.DriverID,NEW.DeliveryVID); END;



LinkBack URL
About LinkBacks




Reply With Quote
Bookmarks