i got tis trigger
CREATE PROCEDURE updateG AFTER INSERT ON gnojidba FOR EACH ROW BEGIN DECLARE box int; SELECT quantity INTO box FROM stock WHERE name = NEW.name; IF (box >= NEW.Qty_value) THEN UPDATE stock SET quantity = (quantity-NEW.Qty_value) WHERE name = NEW.name; ELSE UPDATE 'Error!' SET x=1; END IF; END;
Problem: after user input quantity is changed in both tables and thats ok, but if user enters quantity that is greater than quantity in stock table, that greater value is inserted and stock quantity stays the same. I try also with raise error..., call, signal...etc.
Is it possible to alert user somehow on such a event?