0

Hi,
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?
tnx
Igor

2
Contributors
2
Replies
6
Views
5 Years
Discussion Span
Last Post by farkZ
0

until my host update to 5.5 ill use this

....
   WHERE something= NEW.something;
        ELSE
            CALL nonexistingprocedure;
        END IF;
END;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.