I have to create a trigger to add 'NoOfCustomers' into the STORE table. If the number of customers is greater than the limit then it will display an error message. I'm getting the error "bad bind variable 'NEW.NOOFCUSTOMERS'" when trying to run the trigger and I can't seem to work out why.
CREATE OR REPLACE TRIGGER NoOfCustomersTrigger
BEFORE INSERT ON STORE
FOR EACH ROW
DECLARE V_CAPACITY SHOPS.LIMIT%TYPE;
BEGIN
SELECT LIMIT INTO V_LIMIT
FROM SHOPS, SERVES
WHERE CUSTID = SERVES.CUSTID AND STORENO = :NEW.STORENO;
IF (:NEW.NOOFCUSTOMERS > V_LIMIT) THEN
RAISE_APPLICATION_ERROR (-20004,'The Number of Customers exceeds the LIMIT');
END IF;
END;