Hey all so I am trying to create a trigger that will Update values in a table when they fall below a certain value.
For example say I have table Inventory:
Item | Quantity
-----|---------
A | 400
B | 160
C | 1200
D | 105
I want to make a trigger that will add a random value(100 - 200) if Quantity of an item should ever drop below 100.
This is what I have come up with:
CREATE OR REPLACE TRIGGER QuantityTrigger
AFTER
UPDATE ON INVENTORY FOR EACH ROW
BEGIN
IF :QUANTITY < 100 THEN
UPDATE INVENTORY
SET QUANTITY = QUANTITY + dbms_random.value(100,200);
END IF;
END;
However this gives me error: Error(2,9): PLS-00049: bad bind variable 'QUANTITY'
What am I doing wrong? Any advice is appreciated. Thanks!
Error(2,9): PLS-00201: identifier 'QUANTITY' must be declared