Can you tell me what i’m doing wrong here getting the bad bind error?
The code is to manage stock. I have to identify when stock reaches its minimum on-hand quantity and then re-order that product.
CREATE OR REPLACE TRIGGER REORDER_STOCK
BEFORE INSERT OR UPDATE OF STK_QOH,STK_MIN ON STOCK
FOR EACH ROW
DECLARE
V_STK_QOH stock.STK_QOH%TYPE;
V_STK_MIN stock.STK_MIN%TYPE;
V_STK_REORDER STOCK.STK_REORDER%TYPE;
BEGIN
SELECT STK_QOH, STK_MIN, STK_REORDER
INTO V_STK_QOH, V_STK_MIN, V_STK_REORDER
FROM STOCK
WHERE STK_ID= :NEW.STK_ID;
IF:V_STK_QOH<= :STK_MIN THEN
:V_STK_REORDER := 1;
ELSE :V_STK_REORDER :=0;
END IF;
END;
/
This part:
should just be:
Not sure what’s required to “re-order that product”, but if you’re just wanting to set
STOCK.STK_REORDERto a “1” if it reaches its minimum on hand quantity, then this is all you need: