Question

i'm trying to update the table whenever complaint has been registered

create or replace trigger complaint_advertise
    BEFORE INSERT ON COMPLAINT_INFO FOR EACH ROW
    DECLARE BEGIN
    UPDATE ADVERTISEMENT SET AD_APPEAR='INVALID' WHERE AD_ID=NEW:AD_ID
    END;

But, getting error ERROR at line 2: PLS-00049: bad bind variable 'AD_ID'

Was it helpful?

Solution

The code should read:

create or replace trigger complaint_advertise
BEFORE INSERT ON COMPLAINT_INFO FOR EACH ROW
DECLARE
BEGIN
    UPDATE ADVERTISEMENT SET AD_APPEAR='INVALID' WHERE AD_ID=:NEW.AD_ID;
END;
/
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top