Hi all,
I've create a trigger which work on 2 tables like this: - when insert a new row on table A (GEDDFILES) then a number field on table B(GEDDIRS) will be increased.
Code is getting compiled without errors but it doesn't work. the code is bellow:
CREATE OR REPLACE TRIGGER "A"."TRGMAJNRFIC" AFTER
INSERT ON "A"."GEDFILES" FOR EACH ROW DECLARE
wtmpnrfic number;
BEGIN
SELECT MAX(OBJNRFICHIERS) INTO wtmpnrfic from GEDDirs WHERE ID= :new.ID;
UPDATE GEDDirs SET OBJNRFICHIERS = wtmpnrfic+1 WHERE ID=:new.id;
END;
Tables are normalized and PK from GEDDIRS(field ID) is FK in table GEDFILES (field ID)
I can't figure out where is the problem, even is a little one.
The field OBJNRFICHIERS from table GEDFILES is null. Can be this a problem when i'm trying to increase it's value?
Thanks in advance!
Best regards,