AMS_1989 AMS_1989 - 5 months ago 20
SQL Question

oracle sql developer missing on keyword

I keep getting the "missing on keyword" message on the following query and I'm not sure why:

CREATE OR REPLACE TRIGGER TRG_LINE_PRODUCT AFTER INSERT UPDATE OR DELETE ON
TBL_CH08_LINE FOR EACH ROW
BEGIN
IF INSERTING THEN UPDATE TBL_CH08_PRODUCT P SET P_QOH = P_QOH-:NEW.LINE.UNITS
WHERE P.P_CODE = :NEW.P.P_CODE;
END IF;
END;
/

Answer

You are missing an OR, in fact:

CREATE OR REPLACE TRIGGER TRG_LINE_PRODUCT
    AFTER INSERT OR UPDATE OR DELETE ON TBL_CH08_LINE
-----------------^
    FOR EACH ROW

Oracle is expecting ON after the INSERT, which is why you get that particular error.