cancel
Showing results for 
Search instead for 
Did you mean: 

Row in table 'apinp_invoice' was modified or deleted in BEFORE trigger error

Former Member
1,946

There is no doubt in my mind that I am missing something very basic here, but I am stumped:

I created a trigger to return an image to the original table before the row is deleted in a table later in the process. But when I delete the row in ISQL, I get Row in table 'apinp_invoice' was modified or deleted in BEFORE trigger.

The trigger:

 CREATE OR REPLACE TRIGGER "tbd_apinp_invoice" BEFORE DELETE ORDER 10 ON app_owner.apinp_invoice
   REFERENCING OLD AS old_data
   FOR EACH ROW
BEGIN
    //IF INVOICE SCAN IS PRESENT, MOVE IT BACK TO ORIGINAL SOURCE FILE IF THAT IS APPROPRIATE
    IF old_data.apinp_invoice_scan IS NOT NULL   THEN
        UPDATE edstpspayi_invoice_received
            SET edstpspayi_invoice_scan = old_data.apinp_invoice_scan
            WHERE   old_data.apven_id               = edstpspayi_invoice_received.apven_id      AND
                    old_data.apinp_invoice_number   = edstpspayi_invoice_received.apinp_invoice_number;
        IF sqlcode < 0   THEN
            RAISERROR 18000 '18000 tbd_apinp_invoice sql error ' || sqlcode;
        END IF;
    END IF;
END;

The list of triggers on this table (got error uploading jpg, so here is text):

ta_apinp_invoice   Watcom-SQL   Insert, Update    After
tb_apinp_invoice   Watcom-SQL   Insert, Update    Before
tbd_apinp_invoice  Watcom-SQL   Delete            Before

Accepted Solutions (1)

Accepted Solutions (1)

VolkerBarth
Contributor

What does the before update trigger do? Are there triggers on the other table, too?

I'd add MESSAGE statemens to follow the order of execution in case you suspect cyclic effects...

Former Member
0 Kudos

Are there triggers on the other table, too?

Of course!! The trigger that puts the scan back on the apinp_invoice table...

Duh!

Thanks Volker!

Answers (0)